如何更改Firefox WebDriver端口 [英] How to change Firefox WebDriver Port
本文介绍了如何更改Firefox WebDriver端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好奇的是,如何在不同的端口(例如IE和Chrome驱动程序)上运行firefox驱动程序.该驱动程序具有类似的选项
It is just a curiosity that how can I run firefox driver on different port like IE and Chrome driver.This driver have option like
ChromeDriverService service=new ChromeDriverService.Builder().usingPort(7000).
usingDriverExecutable(new File("")).build();
尽管firefox驱动程序具有类似的选项
though the firefox driver have the option like that
System.setProperty("webdriver.firefox.port","7046");
或
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability("webdriver_firefox_port",7046);
但是它不能在此端口上运行firefox驱动程序,我正在使用2.41 Selenium Webdriver和firefox 31
but it can not run firefox driver on this port I am using 2.41 Selenium Webdriver and firefox 31
任何人都可以解释为什么以及如何在指定端口中运行firefox驱动程序.
Can anyone explain why and how can I run firefox driver in specified port.
推荐答案
好吧,不确定,但这应该可以工作
Well, not sure, but this should work
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("WebDriver");
profile.setPreference(FirefoxProfile.PORT_PREFERENCE, 7046)
WebDriver driver = new FirefoxDriver(profile);
这篇关于如何更改Firefox WebDriver端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文