2017-03-20 36 views
0

当我正在使用JAVA与Firefox驱动程序运行硒代码时,出现错误。 Firefox驱动程序已打开,但无法访问网站地址。确实硒3.x支持firefox驱动和JXL方法吗?

是硒3.x版本支持Firefox驱动程序?

System.setProperty("webdriver.firefox.driver","C:\\Program Files (x86)\\Mozilla Firefox\\firefoxdriver.exe"); 
WebDriver wd = new FirefoxDriver(); 
wd.get("https://www.google.co.in/"); 
+0

是的,它支持,如果你使用Firefox版本45以上,你需要使用Geckodriver。硒3.x将与罚款。 – Gopal

+0

谢谢@Gopal其工作.. – Harikrishna

+0

欢迎@harikrishna – Gopal

回答

0

当使用硒3,你必须下载geckodriver,不再支持firefoxdriver。并使用它如下:

System.setProperty("webdriver.gecko.driver", {path of geckodriver.exe}); 
WebDriver driver = new FirefoxDriver(); 
+0

更准确地说,您可以建议OP使用壁虎驱动程序的绝对路径为“C:\\ absolute_path \\ geckodriver.exe” – DebanjanB

+0

不,这是错误的回答,Selenium 3支持Legacy firefox驱动,Selenium版本与firefox驱动无关,Firefox版本取决于firefox驱动,45以上与geckodriver以及45以下的作品均采用传统firefox驱动。 – RAJ

+0

@RAJ Selenium 3是否支持传统的Firefox驱动程序是一个不同的问题。我已经要求答案提供者在他如何通过键值对的答案时更加清楚,因为从OP的问题中可以清楚地看出他是初学者。 – DebanjanB