running selenium webdriver test cases against multiple browsers

后端 未结 3 1579
野性不改
野性不改 2021-02-02 03:03

I am new to selenium testing. I want to run selenium test cases on multiple browsers against internet explorer, Firefox, opera and chrome. What approach i have to f

3条回答
  •  独厮守ぢ
    2021-02-02 03:42

    web driver supports multiple browsers of course, there is also support for mobile

    ChromeDriver

    IEDiver

    FirefoxDriver

    OperaDriver

    AndroidDriver

    Here is an exemple to run the same tests in multiple browsers.

    package ma.glasnost.test;
    
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
            .........
    DesiredCapabilities[] browserList = {DesiredCapabilities.chrome(),DesiredCapabilities.firefox(),DesiredCapabilities.internetExplorer(), DesiredCapabilities.opera()};
    for (DesiredCapabilities browser : browserList)
    {
        try {
            System.out.println("Testing in Browser: "+browser.getBrowserName());
            driver = new RemoteWebDriver(new URL("http://127.0.0.1:8080/..."), browser);
    

    Hope that helps.

提交回复
热议问题