始终建议在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 );
Run Code Online (Sandbox Code Playgroud)
但是,对于每个硒测试案例,将大量的87-90 mb配置文件信息通过http发送到集线器,从而减慢了测试用例的执行速度.
我尝试"Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"",在json节点配置文件中使用属性配置网格节点,如下所示.
{
"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"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但运行上述配置会导致错误.
WebDriverException:未找到系统属性"webdriver.firefox.profile"中命名的Firefox配置文件"E:\ Firefox_Profile_Location"
高级感谢有关如何从节点端配置firefox配置文件的任何帮助.
TestCafe克服了哪些问题证明它适用于Selenium?是否值得将旧的测试套装移植到TestCafe?
automated-tests web-testing selenium-webdriver e2e-testing testcafe
我尝试使用指定的配置文件启动Firefox:
firefox_profile = webdriver.FirefoxProfile('/Users/p2mbot/projects/test/firefox_profile')
driver = webdriver.Firefox(firefox_profile=firefox_profile)
driver.get('http://google.com')
time.sleep(60)
driver.quit()
Run Code Online (Sandbox Code Playgroud)
/Users/p2mbot/projects/test/firefox_profile - 这个目录是正确的firefox配置文件目录,我创建它 firefox-bin --ProfileManager
但是当我通过selenium检查firefox中的缓存页面时,它有不同的缓存路径:
Storage disk location: /var/folders/jj/rdpd1ww53n95y5vx8w618k3h0000gq/T/tmpp2ahq70_/webdriver-py-profilecopy/cache2
Run Code Online (Sandbox Code Playgroud)
如果通过firefox-bin --ProfileManager运行firefox并选择配置文件,它将显示在about:cache page的正确路径 /Users/p2mbot/projects/test/firefox_profile
为什么webdriver忽略firefox的配置文件路径?使用chrome没有这样的问题.
我正在测试我正在构建的页面,希望能找到是否可以使用硒接受下载提示?我正在使用Firefox Webdriver。