-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrowserJava.java
More file actions
48 lines (37 loc) · 1.99 KB
/
Copy pathBrowserJava.java
File metadata and controls
48 lines (37 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.net.MalformedURLException;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import io.appium.java_client.android.AndroidDriver;
public class BrowserJava extends BaseChrome {
public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub
AndroidDriver<WebElement> driver = capabilities();
/*driver.get("http://device.pcloudy.com"); //for hitting the browser on real device we have to call the driver in this order.
driver.findElementByXPath("//*[@id='userId']").sendKeys("sat72331@gmail.com");
driver.findElementByXPath("//*[@id='loginform']/div[2]/input").sendKeys("Rsatyam866#");
driver.findElementByXPath("//*[@id='loginSubmitBtn']").click(); //for finding xpath->rightclick->copyxpath*/
/*driver.get("http://cricbuzz.com");
driver.findElementByXPath("//a[@href='#menu']").click();
driver.findElementByCssSelector("a[title='Cricbuzz Home']").click();
//driver.findElementByXPath("//*[@id=\"top\"]/div/div[3]/div[2]/a").click();
System.out.println(driver.getCurrentUrl());
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("window.scrollBy(0,450)", "");
Assert.assertTrue(driver.findElement(By.xpath("//h4[text()='Top Stories']")).getAttribute("class").contains("header")); //here we are validating that this xpath is containing the header path or not.
//getAttribute("class")->string contains header value here or not.
System.out.println("Pass");*/
driver.get("http://facebook.com");
driver.findElementByXPath("//*[@id='m_login_email']").sendKeys("ram@gmail.com");
driver.findElementByXPath("//*[@id='m_login_password']").sendKeys("Password");;
//driver.findElementByXPath("//button[@value='Log In']").click();
driver.findElementByXPath("//*[@id='u_0_5']/button").click();
System.out.println("Pass");
//Process for debugging adb
//adb devices - unauthorized
//adb -kill server
//adb start-server
//adb devices
}
}