Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.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 除了Firefox之外,测试用例总是失败_Eclipse_Selenium Webdriver_Jasmine - Fatal编程技术网

Eclipse 除了Firefox之外,测试用例总是失败

Eclipse 除了Firefox之外,测试用例总是失败,eclipse,selenium-webdriver,jasmine,Eclipse,Selenium Webdriver,Jasmine,我编写以下代码来测试网页的标题。firefox通过了此测试,但当我尝试在其他浏览器中运行时,显示跳过或失败 I want to run Test cases on Multiple browser. 当我改变声明时 public class clsTestCase { WebDriver driver; String baseurl,nodeurl; @BeforeTest public void beforeTest() throws MalformedUR

我编写以下代码来测试网页的标题。firefox通过了此测试,但当我尝试在其他浏览器中运行时,显示跳过或失败

I want to run Test cases on Multiple browser. 
当我改变声明时

public class clsTestCase {
    WebDriver driver;
    String baseurl,nodeurl;
    @BeforeTest
    public void beforeTest() throws MalformedURLException
    {
      baseurl="http://www.google.com/";
      nodeurl="http://192.168.1.100:5566/wd/hub/";
        DesiredCapabilities cap=DesiredCapabilities.internetExplorer();
        cap.setBrowserName("internet explorer");
        cap.setPlatform(Platform.WINDOWS);
       driver=new RemoteWebDriver(new URL (nodeurl), cap);

    }


    @Test
    public void testAdd() {
        driver.get(baseurl);
        Assert.assertEquals("Google", driver.getTitle());
    }
 @AfterTest
  public void aftrTest()
 {
     driver.quit();

 }    
}

然后通过测试用例。
为什么不为相同的代码传入IE或Chrome?

在初始化驱动程序之前,您应该设置Chrome驱动程序和IE驱动程序

System.setProperty(“webdriver.ie.driver”,“IEServer.exe的路径”); WebDriver驱动程序=新的InternetExplorerDriver()

System.setProperty(“webdriver.ie.chrome”,“chromeserver.exe的路径”);
WebDriver驱动程序=新的ChromeDriver()

我用Python进行测试。您可能需要先下载selenium的“Chrome”和“IE”浏览器驱动程序,然后才能对其进行测试。请参考以下两个链接:;除了@Vadivelan的答案之外,当您在网格上启动客户机和服务器时,也可以从命令行设置IEDriver。
DesiredCapabilities cap=DesiredCapabilities.internetExplorer();
cap.setBrowserName("internet explorer");
 DesiredCapabilities cap=DesiredCapabilities.firefox();
cap.setBrowserName("firefox");