Friday, 3 October 2014

Selendroid Setup:

1.       Download Android sdk from the site http://developer.android.com/sdk/index.html
2.       Extract the zip file
3.       Install SDK Manager.exe
4.       Download the below files from the site http://selendroid.io/
a.  Selendroid Standalone with dependencies
b. Selendroid Test App

5.       Paste both the above files in platform-tools path
                                D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools
6.       Create the below environment variables     
ANDROID_HOME:  D:\adt-bundle-windows-x86_64-20140321\sdk
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_05
path: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools
7.       Go to eclipse and create the Android project
8.       Create Android Virtual devise
9.       Start the selendroid server as below
¨       Go the command prompt
¨       type cd  D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools and click on enter
¨       type D: and press enter
¨       type below command and press enter
java -jar selendroid-standalone-0.10.0-with-dependencies.jar -app selendroid-test-app-0.10.0.apk
 
Run the program from Eclipse
 
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
 
import junit.framework.TestCase;
 
public class Gmail {
public WebDriver driver;
        @Test
        public void login(){
                     driver=new RemoteWebDriver(DesiredCapabilities.android());
            driver.get("http://gmail.com");
            driver.findElement(By.id("Email")).sendKeys("jan30selenium");
            driver.findElement(By.id("Passwd")).sendKeys("selenium1");
            driver.findElement(By.id("signIn")).click();      
        }
 
}








0 comments:

Post a Comment