Professional Documents
Culture Documents
SELENIUM
SELENIUM
· WebDriver
Classes:
· ChromeDriver
· FirefoxDriver
· InternetExplorerDriver
Explanation:
2. Name.
3. X-Path.
4. CSS Selectors.
5. Link text.
6. Class name
7. Tag name.
Xpath:
//tagName[@attribute='value'] - xpath syntax
//input[@id='input-telephone']
Excercise:
package Automation;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
//X-path
driver.findElement(By.xpath("//*[@type='text']")).sendKeys("anees");
driver.findElement(By.xpath("//input[contains(@name,'pass')]")).sendKeys("test1234");
driver.findElement(By.xpath("//input[@title='Sign in']")).click();
}
<input type="text" id="login1" maxlength="100" name="login" value="" tabindex="1">
XPATH:
//tagName[@attribute='value']
//input[@type='text']
//input[@id='password']
//input[@title='Sign in']
System.out.println(driver.getTitle());;
driver.close();