Firefox未从selenium grid nodeconfig获取配置文件
我在我的nodeconfig.json for firefox中指定使用默认配置文件,而不是每次都创建一个新的配置文件 但是,它仍然会每次创建一个新的配置文件,如第3行所示Firefox未从selenium grid nodeconfig获取配置文件,selenium,selenium-webdriver,selenium-grid,selenium-firefoxdriver,firefox-marionette,Selenium,Selenium Webdriver,Selenium Grid,Selenium Firefoxdriver,Firefox Marionette,我在我的nodeconfig.json for firefox中指定使用默认配置文件,而不是每次都创建一个新的配置文件 但是,它仍然会每次创建一个新的配置文件,如第3行所示 1530174032396 geckodriver INFO geckodriver 0.20.1 (685f18325cea0a282c736e65972f95aa6db7ca48 2018-04-03) 1530174032423 geckodriver INFO Listening
1530174032396 geckodriver INFO geckodriver 0.20.1 (685f18325cea0a282c736e65972f95aa6db7ca48 2018-04-03)
1530174032423 geckodriver INFO Listening on 127.0.0.1:41007
1530174032522 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\lharries\\AppData\\Local\\Temp\\rust_mozprofile.wIKc55QUmufr"
1530174040955 Marionette INFO Listening on port 2714
09:20:41.125 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
09:20:41.208 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session e22e831e-4393-43f1-9d77-b6bd894a6f32 (org.openqa.selenium.firefox.GeckoDriverService)
1530174056358 addons.productaddons WARN Failed downloading XML, status: 0, reason: error
1530174056771 addons.productaddons WARN Failed downloading via XHR, status: 0, reason: error
[Child 28464, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
下面是我的nodeConfig.JSON
我将“webdriver.firefox.profile”:“default”放在浏览器详细信息后的第二行
{
"capabilities":
[
{
"browserName": "firefox",
"version": "60",
"platform": "Windows 10",
"seleniumProtocol": "WebDriver",
"maxInstances": 8
},
{
"browserName": "chrome",
"version": "66",
"platform": "Windows 10",
"seleniumProtocol": "WebDriver",
"maxInstances": 8
},
{
"browserName": "internet explorer",
"version": "11",
"seleniumProtocol": "WebDriver",
"maxInstances": 5
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"webdriver.firefox.profile":"default",
"maxSession": 8,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
这就是我创建驱动程序对象的方式,DriverConfig是我创建的一个类,用于从应用程序设置中提取信息
ICapabilities caps = new DesiredCapabilities();
//generic Desktop Browser config':
if (DriverConfig.BrowserName != "")
{ ((DesiredCapabilities)caps).SetCapability("browserName", DriverConfig.BrowserName); }
else
{ }
if (DriverConfig.Version != "")
{ ((DesiredCapabilities)caps).SetCapability("version", DriverConfig.Version); }
else
{ }
if (DriverConfig.Platform != "")
{ ((DesiredCapabilities)caps).SetCapability("platform", DriverConfig.Platform); }
else
{ }
Instance = new RemoteWebDriver(new Uri(DriverConfig.BrowserExecutionAddress), caps);
// Maximise the window for consistency
Instance.Manage().Window.Maximize();
// Go to the start URL
Instance.Navigate().GoToUrl(DriverConfig.BrowserStartURL);
更新:
我还尝试了以下功能示例,但没有成功
更新的nodeConfig.json
{
"capabilities":
[
{
"browserName": "firefox",
"version": "60",
"platform": "Windows 10",
"seleniumProtocol": "WebDriver",
"maxInstances": 8,
"alwaysMatch": {
"moz:firefoxOptions": {
"args": ["-profile", "C://SeleniumGrid//Profiles//1tzit6yx.Automation"]
}
}
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 8,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
我尝试了以下使用配置设置网格的方法
java -jar SeleniumJars/selenium-server-standalone-3.12.0.jar -role node -nodeConfig nodeconfigFF.json
java -Dwebdriver.firefox.profile=Automation -jar SeleniumJars/selenium-server-standalone-3.12.0.jar -role node -nodeConfig nodeConfigFF.json
java -Dwebdriver.firefox.profile="C://SeleniumGrid//Profiles//1tzit6yx.Automation" -jar SeleniumJars/selenium-server-standalone-3.12.0.jar -role node -nodeConfig nodeConfigFF.json
所有连接和调用浏览器,但仍然在temp中创建配置文件我认为这是预木偶配置,不会与木偶一起工作。您知道我现在会怎么做吗?我很难在网上找到任何清晰的文档。看看这是否有帮助?使用更新的,看看他们是否工作用你的代码更新问题trial@TarunLalwani如果我用FirefoxOptions创建一个FirefoxDriver,那就行了,我是如何使用RemoteWebDriver的通用功能来实现这一点的。因此,将重点放在尝试在selenium网格中的节点级别而不是在测试中设置它,因为测试不知道它们针对的是哪个浏览器。