首页 > 解决方案 > 如何通过 Selenium 4 运行特定的浏览器?

问题描述

你能帮我吗?

我应该使用“Selenium 4.0.0-beta2”,但我无法运行自定义驱动程序和自定义浏览器

我的 3.14 解决方案(效果很好):

ChromeOptions options = new ChromeOptions();
options.BinaryLocation = @"c:\Temp\MySpecificBrowser.exe";
new ChromeDriver(@"c:\Temp\chrome_driver_path", options);

我的 4.0 beta 解决方案:

var service = ChromeDriverService.CreateDefaultService(@"c:\Temp\chrome_driver_path", @"c:\Temp\MySpecificBrowser.exe");
var driver = new ChromeDriver(service);

我的自定义浏览器已打开,但出现错误:OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:5055/'

我的解决方案不正确还是 Selenium 4 beta 的缺陷?

标签: selenium-chromedriverselenium4

解决方案


推荐阅读