【问题标题】:Selendroid does not open the URL when I use it with Selenium Grid当我将它与 Selenium Grid 一起使用时,Selendroid 不会打开 URL
【发布时间】:2015-08-29 15:00:48
【问题描述】:

当我将它与 Selenium Grid 一起使用时,Selendroid 不会打开 URL。以下是我遵循的步骤 1) 使用 Selendroid Grid 插件和 Selenium Grid Jar 启动 Grid Hub

java -Dfile.encoding=UTF-8 -cp "selendroid-grid-plugin-0.15.0.jar;selenium-   
server-standalone-2.45.0.jar" org.openqa.grid.selenium.GridLauncher -
capabilityMatcher io.selendroid.grid.SelendroidCapabilityMatcher -role hub -
host 192.168.1.30 -port 4444 

2)在VM(即节点)中打开AVD

3)使用以下命令启动selendroid节点

java -jar selendroid-standalone-0.15.0-with-dependencies.jar -port 5556 -hub    
http://192.168.1.30:4444/grid/register -proxy 
io.selendroid.grid.SelendroidSessionProxy -host 192.168.1.8

集线器 IP : 192.168.1.30 节点IP:192.168.1.8

4) 导航到 http://192.168.1.30:4444/grid/console - 能够查看添加的节点 5)在集线器机器上运行以下脚本。 Selendroid Web 视图正在打开,但无法打开 URL

package io.selendroid.demo.mobileweb;

import java.net.URL;

import io.appium.java_client.android.AndroidDriver;
import io.selendroid.client.SelendroidDriver;
import io.selendroid.common.SelendroidCapabilities;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class SelendroidTestWeb {



@Test
public void testSel() throws Exception
{

    DesiredCapabilities capability =  DesiredCapabilities.android();

    WebDriver driver = new SelendroidDriver(new URL("http://192.168.1.8:5556/wd/hub"), capability);


    driver.get("http://www.store.demoqa.com"); 

    driver.findElement(By.xpath(".//*[@id='account']/a")).click();
    Thread.sleep(10000);
    driver.findElement(By.id("log")).sendKeys("testuser_1");

    driver.findElement(By.id("pwd")).sendKeys("Test@123");

    driver.findElement(By.id("login")).click();
    // Check the title of the page
    System.out.println("Page title is: " + driver.getTitle());
    driver.quit();


}

}

注意:我可以在 Hub 和 Node 之间 ping 通,并且没有防火墙问题

【问题讨论】:

    标签: android selenium appium selenium-grid selendroid


    【解决方案1】:

    您必须在集线器上注册您的WebDriver,而不是在节点上:

    WebDriver driver = new SelendroidDriver(new URL("http://192.168.1.30:4444/wd/hub"), capability);
    

    【讨论】:

      猜你喜欢
      • 2018-09-12
      • 1970-01-01
      • 2012-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多