I've been following the instructions at:
http://code.google.com/p/selenium/wiki/AndroidDriver
And I've managed to get the following working so far:
- Installed Android SDK
- Updated it
- Made and ran an AVD image
- Installed Eclipse and ADT plugin but haven't learnt Eclipse yet. (I'm trying to compile things from the command line only.)
- Ran the emulation on the Android emulator
- Install WebDriver APK on Emulation using adb -s -e install -r
- Set up portforwarding for the above
- Webdriver started is displayed on the emulator
- Downloaded selenium-java-x.jar
- Downloaded junit-x.jar
- Determined classpath for compiling the code
Compiled using javac, I don't know if this is right:
javac -classpath c:_projects\junit\junit-4.10.jar;c:_projects\selenium-java\selenium-java-2.17.0.jar OneTest.java
Here is my test:
import junit.framework.TestCase;
import org.openqa.selenium.WebDriver; //VERY IMPORTANT. This line is not in the example on the Selenium AndroidDriver website.
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.android.AndroidDriver;
public class OneTest extends TestCase
{
public void testGoogle() throws Exception
{
WebDriver driver = new AndroidDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
}
Now I'm stuck on this section: http://code.google.com/p/selenium/wiki/AndroidDriver#Build_the_Android_Code
Where do I run these commands? For example $./go android_client etc. I think I just need to know how to compile properly and how to forward this test to the emulator. But I could be totally on the wrong track.
My versions are:
- Eclipse: 3.7.1
- Selenium server: 2.17.0
- AndroidDriver: 2.16.0
- Android SDK Tools Revision 16