0

As per the documentation, I see that SelendroidDriver requires two arguments to be passed. I am not sure if I have got confused, but the editor is simply not allowing me to add just driver = new SelendroidDriver(capa); When I mouse hover on the code, I see this message, "The constructor SelendroidDriver(SelendroidCapabilities) is undefined 1 fix available Add argument to match "SelendroidDriver(URL, capabilities)

Can someone please clarify?

http://mavenbrowse.pauldoo.com/central/io/selendroid/selendroid-client/0.10.0/selendroid-client-0.10.0-javadoc.jar/-/io/selendroid/SelendroidDriver.html

Check the Constructor Summary section in the above link. SelendroidDriver class can take two arguments. I am totally confused now! Constructor Summary SelendroidDriver(org.openqa.selenium.Capabilities caps) SelendroidDriver(URL url, org.openqa.selenium.Capabilities caps)

Here is my full code,

import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import io.selendroid.SelendroidDriver;
import io.selendroid.common.SelendroidCapabilities;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class TestClass1 {


public static void main(String[] args) throws Exception{

try{

    SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.14.0");

    WebDriver driver = new SelendroidDriver("http://localhost:4444/wd/hub/status", capa);
    WebElement inputField = driver.findElement(By.id("my_text_field"));
    inputField.sendKeys("Selendroid");
    driver.quit();
}

catch(Exception E)

{
    throw E; 
}

}
}
Sandeep
  • 153
  • 2
  • 4
  • 16

2 Answers2

0

There seem to be no constructor :

 SelendroidDriver(String url, org.openqa.selenium.Capabilities caps)

So possibly you want to do:

WebDriver driver = new SelendroidDriver(new URL("http://localhost:4444/wd/hub/status"), capa);
Erki M.
  • 5,022
  • 1
  • 48
  • 74
  • What error does it throw? It should work. If it throws UnReachableBrowserException, put IPv4 address of your machine in place of localhost. In my case, this works fine : selendroidDriver = new SelendroidDriver(selendroidCapabilities); – Namrata Bagerwal Apr 21 '15 at 09:53
0

The error is correct...u r passing capabilities that are from io.selendroid.common.SelendroidCapabilities instead of org.openqa.selenium.Capabilities...and another thing u r also passing String instead of URL object...

Vivek Singh
  • 3,641
  • 2
  • 22
  • 27