我正在使用Firefox-53,Selenium-3.4并且在执行下面的代码时出现错误。
{
System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\geckodriver.exe");
WebDriver driver ;
driver = new FirefoxDriver();driver.get("http://www.store.demoqa.com");
}
enter code here
错误-用法:
enter code here
D:\Selenium\geckodriver.exe`enter code here` [OPTIONS]`enter code here`
D:\Selenium\geckodriver.exe: Unknown option --port=26528`enter code here`
Exception in thread "main"`enter code here` org.openqa.selenium.WebDriverException:`enter code here` org.apache.http.conn.HttpHostConnectException:`enter code here` Connect to localhost:26528 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
enter code here
提前致谢: - )
答案 0 :(得分:0)
似乎应该完成“输入代码在这里”部分。你可以轻松找到正确的例子并为你改变它。
例如,
http://toolsqa.com/selenium-webdriver/how-to-use-geckodriver/
package seleniumPrograms;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Gecko_Driver {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "D:\\\\ToolsQA\\trunk\\Library\\drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.toolsqa.com");
Thread.sleep(5000);
driver.quit();
}
}