当我在Selenium Grid中使用它时,Selendroid不会打开URL.Below是我遵循的步骤 1)使用Selendroid Grid Plugin和Selenium Grid Jar
启动Grid Hubjava -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
Hub IP:192.168.1.30 节点IP:192.168.1.8
4)导航到http:// 192.168.1.30:4444/grid/console - 能够查看添加的节点 5)在Hub Machine上运行以下脚本。 Selendroid Web View正在打开,但无法打开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,并且没有防火墙问题
答案 0 :(得分:0)
您必须在集线器上注册WebDriver
,而不是在节点上注册:
WebDriver driver = new SelendroidDriver(new URL("http://192.168.1.30:4444/wd/hub"), capability);