我有以下代码。我将Selenium Web驱动程序更新为v3.14,它显示了过时和错误消息。
DesiredCapabilities capabilities; --deprecated
capabilities = DesiredCapabilities.Chrome(); --has the error for Selennium wen driver v3.14
capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));
Uri uri = new Uri(hub url);
_driver = new RemoteWebDriver(uri, capabilities, TimeSpan.FromSeconds(120));
From class RemoteWebDriver in OpenQA.Selenium.Remote, it still has the ICapabilities parameter
public RemoteWebDriver(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout);
我看到了一些使用Chrome选项的帖子。但是我仍然不能使它适用于硒网格。有想法吗?
答案 0 :(得分:0)
以下内容应该可以正常工作:
ChromeOptions options = new ChromeOptions();
options.PlatformName = "windows";
Uri uri = new Uri(hub url);
_driver = new RemoteWebDriver(uri, options.ToCapabilities(), TimeSpan.FromSeconds(120));