Selendroid does not open the URL when I use it with Selenium Grid

378 views Asked by At

Selendroid does not open the URL when I use it with Selenium Grid.Below are the steps that I followed 1) Initiated the Grid Hub using the Selendroid Grid Plugin and 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) Opened the AVD in the VM (i.e. the node)

3)Initiated the selendroid node using the below command

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 Node IP: 192.168.1.8

4) navigate to http:// 192.168.1.30:4444/grid/console – was able to view the node that was added 5) Ran the below script on the Hub Machine. The Selendroid Web View is opening but it is unable to open the 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();


}

}

Note: I am able to ping among the Hub and Node and there is no firewall issue

1

There are 1 answers

0
peetya On

You have to register your WebDriver on the hub, and not on the node:

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