seleniumChromedriver:无法创build频道

我在过去的几周里一直在使用Selenium Chromedriver,突然间我发现了这个奇怪的错误。 我不知道突然发生了什么变化。

[2560:6100:1025/082057:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. [ERROR] Unhandled exception occured. SessionNotCreatedError: session not created exception from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"9556.1","isDefault":true},"id":1,"name":"","origin":"://"} (Session info: chrome=54.0.2840.71) (Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 10.0.14393 x86_64) 

我用Node.js运行chromedriver:

 var selenium = require("selenium-webdriver/chrome"), options = new selenium.Options(), service = new selenium.ServiceBuilder().build(); options.addArguments(["--disable-web-security", "-incognito"]); var driver = new selenium.Driver(options, service); driver.get(fetchSource.url).then(function() { browser = driver; fetchSource.ready = true; console.log("Ready to fetch data."); }); 

更新chronedriver版本没有帮助。 任何想法如何解决这个错误? 谢谢!

原来chrome自动更新,而且新版本由于某种原因与chromedriver不兼容。 运行旧版本的chrome解决了这个问题。 在Node.js中,您可以通过更改选项对象来自定义可运行镶边的path:

 options.setChromeBinaryPath('path\to\chrome');