相关疑难解决方法(0)

Selenium测试在移动设备上是否值得?

我们一直在计划使用Selenium对我们的Web应用程序进行UI测试.我们现在有了第二个想法.据我所知,Android和iOS设备的网络驱动程序不使用用户将使用的实际浏览器.相反,他们使用WebView,它可能与实际浏览器类似,也可能不同.我已经看到了针对Android的各种报告,这些报告似乎表明WebView的行为与内置浏览器和Chrome不同,后者现在是某些设备的默认设置.

您是否发现使用Selenium在实际硬件设备上进行测试是否值得?它比使用模拟器更准确还是更准确?您发现什么是使用自动化测试的最有效方法,让您觉得您的Web应用程序可以在您支持的所有硬件平台上正常运行?

在我们的案例中,我们需要在PC,Mac,平板电脑和手机上支持最新版本的主流浏览器.Selenium在PC测试中运行良好,但我对平板电脑和手机测试很关注.我们正在考虑是否应该自己推广或使用类似uitest.js的东西,我们实际上可以在实际的设备浏览器上运行.

selenium android ui-testing ios selenium-webdriver

10
推荐指数
1
解决办法
1万
查看次数

使用Java和TestNG在WebDriver上同时在不同的操作系统和浏览器上执行测试

我在我的系统中配置了网格并编写了我的测试脚本.我可以在任何指定的操作系统和任何浏览器上运行我的测试,但一次只能在一个操作系统和一个浏览器上运行,而不是所有操作系统和所有浏 这就是我所做的.请告诉我如何配置它以便它可以在一次配置的OS中运行.

我使用Java的脚本如下:

import java.net.MalformedURLException;
import java.net.URL;
import org.junit.AfterClass;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;

public class GridWithWebdriver {

    public WebDriver driver;

    @Parameters({"browser"})
    @BeforeClass
    public void setup(String browser) throws MalformedURLException {
        DesiredCapabilities capability=null;

        if(browser.equalsIgnoreCase("firefox")){
            System.out.println("firefox");
            capability= DesiredCapabilities.firefox();
            capability.setBrowserName("firefox"); 
            capability.setPlatform(org.openqa.selenium.Platform.ANY);
            //capability.setVersion("");
        }

        if(browser.equalsIgnoreCase("iexplore")){
            System.out.println("iexplore");
            capability= DesiredCapabilities.internetExplorer();
            capability.setBrowserName("iexplore"); 
            capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
            //capability.setVersion("");
        }

        driver = new RemoteWebDriver(<span class="IL_AD" id="IL_AD11">new URL</span>("http://localhost:4444/wd/hub"), capability);
        driver.navigate().to("http://google.com");

    }

    @Test
    public void test_first() throws InterruptedException{
        Thread.sleep(3000);
        WebElement search_editbox   =   driver.findElement(By.name("q"));
        WebElement search_button    =   driver.findElement(By.name("btnG"));
        search_editbox.clear();
        search_editbox.sendKeys("first");
        search_button.click();
    } …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-grid

9
推荐指数
1
解决办法
4486
查看次数