0% found this document useful (0 votes)
37 views

Code 2

Uploaded by

SuprinAhluwalia
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Code 2

Uploaded by

SuprinAhluwalia
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import org.openqa.selenium.

By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class facebookxpath {

public static void main(String[] args) {


// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver",
"C://work//chromedriver.exe");

WebDriver driver =new ChromeDriver();


driver.get("http://facebook.com");

////tagName[@attribute='value'] - xpath
/* driver.findElement(By.xpath("//*[@type='email']")).sendKeys("myown
xpath");
driver.findElement(By.xpath("//input[@id='pass']")).sendKeys("hello");
driver.findElement(By.xpath("//input[@value='Log In']")).click();*/

//tagName[v='value'] -CSS

driver.findElement(By.cssSelector("input[name='email']")).sendKeys("myowncss");
driver.findElement(By.cssSelector("[value='Log In']")).click();

You might also like