当我在eclipse中运行脚本时,它首先在firefox中打开“地址无效”的选项卡,然后打开我在脚本中提到的站点的URL。请告诉我这个错误为什么会发生? 请参阅随附的屏幕截图。image shows the error details
答案 0 :(得分:0)
希望它能解决你的问题
public class TestTestCaseEX {
WebDriver driver;
@BeforeMethod
public void setUp() throws Exception {
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe"); //give your firefox driver path
driver = new FirefoxDriver();
String baseURL="https://accounts.google.com"
driver.get(baseURL);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Testclass)
public void testing() throws InterruptedException {
}
@AfterMethod
public void tearDown() {
driver.close();
}
}
答案 1 :(得分:0)
试试这个::
System.setProperty("webdriver.gecko.driver", "E:\\Selenium_FF\\geckodriver.exe");
driver = new FirefoxDriver();
String baseURL="https://stackoverflow.com/";
driver.get(baseURL);