Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Last active August 29, 2015 14:02
Show Gist options
  • Save prashanth-sams/def3705fdcaea0a7c6c5 to your computer and use it in GitHub Desktop.
Save prashanth-sams/def3705fdcaea0a7c6c5 to your computer and use it in GitHub Desktop.
package pack;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class Webappandroid {
public WebDriver driver = null;
private String baseUrl;
@BeforeMethod
public void setUp() throws Exception{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "chrome");
baseUrl = "https://in.yahoo.com";
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@AfterMethod
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void test01() throws InterruptedException {
driver.get(baseUrl + "/");
driver.findElement(By.id("p")).sendKeys("prashanth sams");
Thread.sleep(3000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment