Friday, February 1, 2013

Uploading photo in facebook using WebDriver

Automate Facebook with WebDriver
Uploading photo in facebook

driver.get("http://www.facebook.com");  
  driver.findElement(By.id("email")).clear();  
  driver.findElement(By.id("email")).sendKeys("*******@gmail.com");  
  driver.findElement(By.id("pass")).clear();  
  driver.findElement(By.id("pass")).sendKeys("*******");  
  driver.findElement(By.cssSelector("#loginbutton > input")).click();  
  driver.findElement(By.linkText("Facebook")).click();  
  driver.findElement(By.linkText("Add Photos/Video")).click();  
  driver.findElement(By.xpath("//div[text()='Upload Photos/Video']/
                           following-sibling::div/input")).sendKeys("C:\\MyPhoto.jpg");  

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.