0% found this document useful (0 votes)
43 views1 page

Code 2

Uploaded by

SuprinAhluwalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Code 2

Uploaded by

SuprinAhluwalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
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