当我在Selenium Grid.Below中使用Selendroid时,Selendroid无法打开URL。我遵循了以下步骤: 1)使用Selendroid Grid插件和Selenium Grid Jar启动网格中心
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();
}
}注:我可以在集线器和节点之间执行ping操作,并且没有防火墙问题
发布于 2015-06-15 17:58:50
您必须在集线器上注册WebDriver,而不是在节点上:
WebDriver driver = new SelendroidDriver(new URL("http://192.168.1.30:4444/wd/hub"), capability);https://stackoverflow.com/questions/30822753
复制相似问题