【问题标题】:selenium cannot run on eclipse [duplicate]硒无法在eclipse上运行[重复]
【发布时间】:2017-07-28 16:17:00
【问题描述】:
package com.confirm;
  import org.openqa.selenium.Alert;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.testng.annotations.Test;
  public class ConfirmDemo {
    WebDriver driver = new FirefoxDriver();
    @Test
    public void ExampleForConfrim() throws InterruptedException {
     driver.manage().window().maximize();
     driver.get("file:///C:/confirm.html");
     Thread.sleep(2000);
     driver.findElement(By.xpath("//button[@onClick='confirmFunction()']"));
     Alert alert=driver.switchTo().alert();
     System.out.println(alert.getText());
     alert.dismiss();
     driver.close();
 }
}

这是我的第一个 selenium 程序。我在 eclipse 中输入这段代码,并为 selenium 添加外部 jar 文件,当我运行 eclipse 时说:

所选内容无法启动,并且最近没有启动。

如何解决?

【问题讨论】:

    标签: java eclipse selenium


    【解决方案1】:

    看起来这个问题与 eclipse 的关系比与 Selenium 的关系更大,请查看 this question and it's answer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-28
      • 1970-01-01
      • 1970-01-01
      • 2014-07-16
      • 2017-11-23
      • 2021-11-21
      • 2018-02-18
      • 1970-01-01
      相关资源
      最近更新 更多