Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse 当脚本运行时,页面打开时出现一个错误,表明地址无效_Eclipse_Selenium_Automation - Fatal编程技术网

Eclipse 当脚本运行时,页面打开时出现一个错误,表明地址无效

Eclipse 当脚本运行时,页面打开时出现一个错误,表明地址无效,eclipse,selenium,automation,Eclipse,Selenium,Automation,当我在eclipse中运行脚本时,它首先在firefox中打开“地址无效”的选项卡,然后打开我在脚本中提到的站点的url。请告诉我那个错误为什么会发生? 请参阅附带的屏幕截图。希望它能解决您的问题 public class TestTestCaseEX { WebDriver driver; @BeforeMethod public void setUp() throws Exception { System.setProperty("webdriver.gecko.driver

当我在eclipse中运行脚本时,它首先在firefox中打开“地址无效”的选项卡,然后打开我在脚本中提到的站点的url。请告诉我那个错误为什么会发生?
请参阅附带的屏幕截图。

希望它能解决您的问题

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();
}

 }
试试这个:

 System.setProperty("webdriver.gecko.driver", "E:\\Selenium_FF\\geckodriver.exe"); 
 driver = new FirefoxDriver();
 String baseURL="https://stackoverflow.com/";
 driver.get(baseURL);

你能分享你的代码吗?@Before public void setUp()抛出异常{driver=new FirefoxDriver();baseUrl=“”;driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);@testuser baseUrl=
“accounts.google.com”;
在结尾显示double;;使用single尝试您的解决方案;它错误地发布在注释中。尝试使用single。但出现相同的错误我认为您的JAR没有更新我编辑了我的答案您可以再试一次,设置gecko驱动程序路径并从下载驱动程序