Text
Text
Text
package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\
Users\\Laptop3\\eclipse-workspace\\Test1'\\driver\\
chromedriver.exe");
WebElement btnCreate =
driver.findElement(By.xpath("//a[text()='Create New
Account']"));
btnCreate.click();
package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\
Users\\Laptop3\\eclipse-workspace\\Test1'\\driver\\
chromedriver.exe");
WebElement btnCreate =
driver.findElement(By.xpath("//a[contains(text(),'New')]"));
btnCreate.click();
package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\
Users\\Laptop3\\eclipse-workspace\\Test1'\\driver\\
chromedriver.exe");
WebElement btnCreate =
driver.findElement(By.xpath("//a[contains(@data-
testid,'registration')]"));
btnCreate.click();
GetText:
package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\
Users\\Laptop3\\eclipse-workspace\\Test1'\\driver\\
chromedriver.exe");
WebElement txtFacebook =
driver.findElement(By.xpath("//h2[contains(text(),'helps')]"));
String text = txtFacebook.getText();
System.out.println(text);
}
GetAttributes(“values”)
package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\
Users\\Laptop3\\eclipse-workspace\\Test1'\\driver\\
chromedriver.exe");
WebElement txtUserName =
driver.findElement(By.id("email"));
txtUserName.sendKeys("Test");
String att = txtUserName.getAttribute("value");
System.out.println(att);