package AutomationTest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Xpath_1 {
public static void main(String[] args) throws InterruptedException {
//System.setProperty("webdriver.chrome.driver", "C:\\Users\\Dell\\Desktop\\Drivers\\latest\\chromedriver_win32 (18)\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("file:///E:/DESKTOP_Items/sampleApp.html");
WebElement text1 = driver.findElement(By.xpath("//p[text()=' Learn selenium ']"));
String mytext1=text1.getText();// through get text methodwe can get the texts from web page and return type-String
System.out.println(mytext1);
WebElement text2= driver.findElement(By.xpath("//p[contains(text(),'learn webservices')]"));
String mytext2=text2.getText();
System.out.println(mytext2);
driver.findElement(By.xpath("//a[starts-with(text(),'facebook')]")).click();
Thread.sleep(5000);
driver.navigate().back();
driver.findElement(By.xpath("//a[contains(text(),'oog')]")).click();
Thread.sleep(5000);
driver.navigate().back();
driver.findElement(By.xpath("//input[contains(@id,'fem')]")).click();
String text3=driver.findElement(By.xpath("//*[@id='male']/preceding::p[1]")).getText();
System.out.println(text3);
driver.findElement(By.xpath("//*[@id='male']/preceding::p[1]/following::input[@id='female']")).click();
driver.findElement(By.xpath("//td[text()='Appium']/../following::td[2]")).click();
}
}