我正在使用Selenium 3.5.3,以下是我的代码 .
我试图在构造函数中使用Firefox选项
https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/firefox/FirefoxDriver.html#FirefoxDriver-org.openqa.selenium.firefox.FirefoxOptions-
FirefoxOptions options=new FirefoxOptions();
options.setProfile(profile);
driver =new FirefoxDriver(options);
我在实例化Firefox驱动程序时遇到错误:
构造函数FirefoxDriver(FirefoxOptions)未定义
我怎么解决这个问题?
Firefox版本55.0.3 64位Geckodriver v0.18.0
3 回答
试试这段代码:
这是供您参考的图片:
问题是由于较旧的硒版本共存 . mvn clean install解决了这个问题 .
您的问题可能与不同原因有关 . 常见原因是你的firefox浏览器的 missaligned version 和/或 gecko driver and/or selenium library .
我解决了这个问题 upgrading gecko驱动程序和selenium库到最新版本 .
在我的情况下,mvn clean install没有解决问题