【发布时间】:2023-03-07 15:20:01
【问题描述】:
始终建议在 DesiredCapabilities 中设置 firefox 配置文件并将其通过集线器运行的线路。如下图
DesiredCapabilities caps = DesiredCapabilities.firefox();
FirefoxProfile profile=new FirefoxProfile(new File("Local Path to firefox profile folder"));
caps.setCapability(FirefoxDriver.PROFILE, profile);
URL url = new URL("http://localhost:4444/wd/hub");
WebDriver driver= new RemoteWebDriver(url,caps );
但是通过 http 将庞大的 87-90 mb 配置文件信息发送到集线器,因为每个 selenium 测试用例都会减慢测试用例的执行速度。
我已经尝试在 json 节点配置文件中使用 "Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"", 属性配置网格节点,如下所示。
{
"configuration":
{
.//Other Settings
.//Other Settings
.//Other Settings
"Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"",
"maxSession":7,
"registerCycle":5000,
"register":true
},
"capabilities":
[
{"browserName":"firefox",
"seleniumProtocol":"WebDriver",
"maxInstances":5,
"platform":"VISTA"
}
]
}
但是使用上述配置运行会抛出以下错误。
WebDriverException: Firefox 配置文件“E:\Firefox_Profile_Location” 在系统属性“webdriver.firefox.profile”中未找到命名
感谢任何有关如何从节点端配置 firefox 配置文件的帮助。
【问题讨论】:
-
你为什么使用firefox配置文件夹而不是通过selenium代码设置配置文件?对firefox配置文件有什么要求?
-
通过代码设置,必须通过http传输到节点端,需要时间。我想通过使用 conde 配置设置在节点端设置 firefox 配置文件配置来减少时间。
标签: selenium selenium-webdriver remotewebdriver selenium-grid2