Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Code 2

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 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