unknown error: cannot get automation extension

今天把Selenium的C# Driver升级到了最新的3.0版,结果Code就一直不能执行了,具体错误信息如下。

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=unknown error: cannot get automation extension
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"2420.1","isDefault":true},"id":1,"name":"","origin":"chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
  Source=WebDriver
  StackTrace:
       at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWindow.get_Size()
       at APX.Cloud.WebElement.WebDriver..ctor(String token) in c:\Git\APX.Cloud\APX.Cloud.WebElement\WebDriver.cs:line 77
       at APX.Cloud.TestBusinessLogic.Common.APXCloudHelper.InitialWebDriver(String driverToken) in c:\Git\APX.Cloud\APX.Cloud.TestBusinessLogic\Common\APXCloudHelper.cs:line 69
       at APX.CloudUI.Test.TestBase.TestInitialize() in c:\Git\APX.Cloud\APX.CloudUI.Test\TestBase.cs:line 160
  InnerException: 


找了很久才发现原来是我的chromedriver.exe版本太旧了,升级到最新版后就好了。在这里有一个小问题, Selenium的版本规则是大版本号+小版本号,所以:

2.1远远早于2.10

2.9比2.10早

各个版本的时间顺序从新到旧是:

2.19>2.10>2.9>2.1


http://selenium-release.storage.googleapis.com/index.html
Chrome Driver:
http://chromedriver.storage.googleapis.com/index.html
PhantomJS Driver:
http://phantomjs.org/download.html

你可能感兴趣的:(自动化测试)