Selenium Chromedriver 101.0.4951.41无法启动DevTools
嗨。今天,我尝试将ChromeDriver升级到101.0.4951.41,这突然使我迅速升级了这个错误。我错过了什么,或者我应该为新版本添加什么?
这是我的代码:
options.AddArgument("start-maximized");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-blink-features");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddArgument("--disable-gpu");
options.AddArgument("--no-sandbox");
options.AddArgument("--allow-running-insecure-content");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--disable-background-networking");
options.AddExcludedArguments(new List<string>() { "enable-automation" });
options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("password_manager_enabled", false);
ChromeDriverService chromeDriverService=ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
IWebDriver Driver = new ChromeDriver(chromeDriverService, options);
IDevTools devTools = Driver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession();
Hi. I tried upgrade my chromedriver to 101.0.4951.41 today and it sudden keep prompt this error to me. Anything I missed or what I should add for new version?
And this is my code:
options.AddArgument("start-maximized");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-blink-features");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddArgument("--disable-gpu");
options.AddArgument("--no-sandbox");
options.AddArgument("--allow-running-insecure-content");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--disable-background-networking");
options.AddExcludedArguments(new List<string>() { "enable-automation" });
options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("password_manager_enabled", false);
ChromeDriverService chromeDriverService=ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
IWebDriver Driver = new ChromeDriver(chromeDriverService, options);
IDevTools devTools = Driver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
添加协议版本(IE)来修复
通过使用DevTools = OpenQA.Selenium.devtools.v96 ;
:
:
IDEVTOOLS DEVTOOLS = WebDriver作为IDEVTOOLS;
Idevtoolssession session = devtools.getDevToolsSession(96);
Fixed by adding the protocol version (i.e.)
using DevTools = OpenQA.Selenium.DevTools.V96;
:
:
IDevTools devTools = webDriver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession(96);
有一个类似的问题,似乎在上面的版本中,等于100需要将远程删除端口参数集设置。
将其添加到args:
Had a similar issue and it seems in versions above and equal 100 need to have the remote-debugging-port argument set.
Add this to args:
当我打开驾驶员本身时,这为我打开了Devtools。我在版本101.0.4951.41上对其进行了测试,因此它应该对您有效。 (无需远程调试端口)
options.addargument(“ - auto-open-devtools for-tabs”);
This opens the devtools for me when I open the driver itself. I tested it on version 101.0.4951.41 so it should work fine for you. (no remote debugging port required)
options.AddArgument("--auto-open-devtools-for-tabs");
显然,新版本的Chromedriver(101.0.4951.41)与DevTools的旧版本不兼容,
我可以解决此问题更新此问题。
Apparently the new version of chromedriver (101.0.4951.41) is not compatible with old version of DevTools
I can solved this issue updated Selenium.WebDriver to 4.1.1 and used "OpenQA.Selenium.DevTools.V101.Network"