问题
Has anyone encountered this issue when Selenium tries to delete cookies?
After months of working fine and not changing anything, we're suddenly hitting this error when running tests:
System.InvalidOperationException : unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"(FE3E5C7422F34F92AF238C0A8EBA89BF)","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=64.0.3282.167)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteCookieJar.DeleteAllCookies()
at FluentAutomation.CommandProvider.<>c__DisplayClass2.<.ctor>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at FluentAutomation.CommandProvider.get_webDriver()
at FluentAutomation.CommandProvider.<>c__DisplayClassc.<FindMultiple>b__a()
at FluentAutomation.ElementProxy.get_Elements()
回答1:
The error says it all :
System.InvalidOperationException : unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"(FE3E5C7422F34F92AF238C0A8EBA89BF)","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=64.0.3282.167)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)
Your main issue is the compatibility between the Version of the Binaries you are using.
- You are using chromedriver=2.9
- Release Notes of chromedriver=2.9 clearly mentions the following :
Supports Chrome v31-34
- You are using Chrome Browser version 64.0
So there is a clear mismatch between the Version of the Binaries.
Solution
- Upgrade your ChromeDriver to recent ChromeDriver=2.35 level.
- As per the Release Notes of ChromeDriver=2.35 upgrade your Chrome Browser to Chrome v62-64 levels.
- If your base Chrome Browser version is too old uninstall Chrome Browser through Revo Uninstaller and install a recent released GA version of Chrome Browser
- Execute your Tests
来源:https://stackoverflow.com/questions/48805882/selenium-error-when-deleting-cookies