Я использую селен "selenium-server-standalone-3.141.59.jar" и запустил концентратор и узел, как показано ниже.Концентратор работает на ПК с Windows, а узел Safari - на MacMini.
java -Xmx4000m -jar selenium-server-standalone-3.141.59.jar -host 192.168.160.116 -role hub -port 4444 -browserTimeout 300 -timeout 300
sudo java -Xmx6000m -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.160.116:4444/grid/register -port 5555 -browser browserName=safari,version=12,platform=mac,acceptSslCerts=true,javascriptEnabled=true -host 192.168.160.72 -debug
Это код для создания экземпляра RemoteWebDriver.Я попытался использовать «options.AddAdditionalCapability(CapabilityType.Timeouts, Settings.PageTimeout.TotalSeconds);
», но это выдает исключение, говорящее «ожидал значение объекта для тайм-аутов, но было 180», затем я передал объект промежутка времени, но тоже не повезло.
case "Safari":
var options = new SafariOptions();
options.AddAdditionalCapability(CapabilityType.BrowserName, "safari");
options.AddAdditionalCapability(CapabilityType.PlatformName, "MAC");
options.AddAdditionalCapability(CapabilityType.Version, "12");
options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);
options.AddAdditionalCapability(CapabilityType.IsJavaScriptEnabled, true);
options.SetLoggingPreference(LogType.Browser, LogLevel.Debug);
options.SetLoggingPreference(LogType.Driver, LogLevel.Debug);
var driver = new RemoteWebDriver(new Uri(Settings.RemoteServerAddress), options);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Settings.PageTimeout.TotalSeconds);
return driver;
Некоторые тесты не выполняются, за исключением следующего.Кто-нибудь сталкивался с такой ситуацией?
[20:55:15][Step 5/8] [ERROR] Name of my cool scenario - valid code: The HTTP request to the remote WebDriver server for URL http://192.168.160.116:4444/wd/hub/session timed out after 60 seconds. -> The request was aborted: The operation has timed out.
[20:55:15][Step 5/8] OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://192.168.160.116:4444/wd/hub/session timed out after 60 seconds. ---> System.Net.WebException: The request was aborted: The operation has timed out.
[20:55:15][Step 5/8] at System.Net.HttpWebRequest.GetResponse()
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
[20:55:15][Step 5/8] --- End of inner exception stack trace ---
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
[20:55:15][Step 5/8] at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
[20:55:15][Step 5/8] at Summatix.Automation.WebDriver.WebDriverFactory.DoCreate(String key)
[20:55:15][Step 5/8] at Summatix.Automation.WebDriver.WebDriverFactory.Create(String key)