使用chromedriver找不到具有指定id的上下文

时间:2018-01-04 14:38:41

标签: c# selenium selenium-chromedriver

我在运行自动化测试时遇到问题。

在这一行:

Wait.Until(ExpectedConditions.ElementExists(findElement))

findElement”是框架中的元素,我是交互式之前的开关。

我认为问题是由于Google Chrome浏览器更新版本为63.0.3239.108引起的,因为此行未更改3个月。

语言:C# 谷歌浏览器版本:63.0.3239.108 Chromedriver版本:2.34.522940

Full StackTracke:

Test Name:  TrocarTecnologiaTest
Test FullName:  AutomacaoIntegra.Tests.TestTrocarTecnologia.TrocarTecnologiaTest
Test Source:    C:\git_repository\integra_test\AutomacaoIntegra\Tests\TestTrocarTecnologia.cs : line 39
Test Outcome:   Failed
Test Duration:  0:00:16,571

结果StackTrace:

em OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   em OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   em OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
   em OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id)
   em OpenQA.Selenium.By.<>c__DisplayClass16_0.<Id>b__0(ISearchContext context)
   em OpenQA.Selenium.By.FindElement(ISearchContext context)
   em OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
   em OpenQA.Selenium.Support.UI.ExpectedConditions.<>c__DisplayClass6_0.<ElementExists>b__0(IWebDriver driver)
   em OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
   em AutomacaoIntegra.Extensions.Element_Extensions.EsperarElemento(IWebDriver driver, By findElement) na C:\git_repository\integra_test\AutomacaoIntegra\Extensions\Element_Extensions.cs:linha 126
   em AutomacaoIntegra.PageObjects.SolicitacaoPage.PesquisarClienteBeneficiario(String CPF) na C:\git_repository\integra_test\AutomacaoIntegra\PageObjects\SolicitacaoPage.cs:linha 117
   em AutomacaoIntegra.Tests.TestTrocarTecnologia.TrocarTecnologiaTest() na C:\git_repository\integra_test\AutomacaoIntegra\Tests\TestTrocarTecnologia.cs:linha 48
Result Message: 
System.InvalidOperationException : unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot find context with specified id"}
  (Session info: chrome=63.0.3239.108)
  (Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.14393 x86_64)

1 个答案:

答案 0 :(得分:0)

问题是因为Google Chrome已针对63.0.3239.108版本进行了更新。我是61版本的降级,我的系统是正常的。