简体   繁体   English

使用Appium并行运行2个真正的android设备

[英]Running 2 real android devices in parallel using Appium

I'm new with Appium and trying to run 2 android devices using Appium and Selenium (Java) parallel but only 1 device is running my test script. 我是Appium的新手,并尝试使用Appium和Selenium(Java)并行运行2个android设备,但只有1个设备正在运行我的测试脚本。 Below is my test script (junit) and having hard time trying to work this out. 下面是我的测试脚本(junit),很难解决。 I'm not using any Grid or Cloud Grid (SauceLabs/BrowserStack) for the mean time as I'd like to monitor this locally for now. 我目前不使用任何网格或云网格(SauceLabs / BrowserStack),因为我现在想在本地进行监视。

public class StartChrome {

public WebDriver driver;

@Before
public void setUp() throws MalformedURLException {
    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability("automationName", "Appium");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("platformVersion", "7.0");
    capabilities.setCapability("browserName", "Chrome");
    capabilities.setCapability("deviceName", "Phone's Name");

    URL url = new URL("http://127.0.0.1:4723/wd/hub");
    driver = new RemoteWebDriver(url, capabilities);
}

@Test
public void test() {
    driver.get("http://saucelabs.com/test/guinea-pig");

    WebElement div = driver.findElement(By.id("i_am_an_id"));
    Assert.assertEquals("I am a div", div.getText());
    driver.findElement(By.id("comments")).sendKeys("My comment");
}

@After
public void tearDown() {
    driver.quit();
}

I'm not really sure what details I need to add here but I'm happy to answer anything and and advice would be very much appreciated. 我不确定我需要在此处添加哪些详细信息,但我很乐意回答任何问题,我们将不胜感激。

Thanks in advance!! 提前致谢!!

First You need to start two appium servers on diffrent ports. 首先,您需要在不同的端口上启动两个appium服务器。 Then you use that URL for both of your scripts and run them in parallel using TesNg. 然后,将两个脚本都使用该URL,然后使用TesNg并行运行它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM