mardi 30 septembre 2014

How can i get the Friends list from Facebook? How to do this one? pls help me.How can i get the names xpath?


Vote count:

0





  1. How can i get the Friends list from Facebook?

  2. How to do this one?

  3. How can i get the names xpath?


  4. pls help me.


    import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver;



    public class FaceBook {
    public static void main(String[] args) throws InterruptedException {
    WebDriver driver = new FirefoxDriver();
    //driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    driver.get("http://ift.tt/g8FRpY");
    driver.findElement(By.id("email")).sendKeys("example@yahoo.com");
    driver.findElement(By.id("pass")).sendKeys("xxxxxxx");
    driver.findElement(By.id("loginbutton")).click();
    Thread.sleep(2000);
    driver.findElement(By.linkText("FRIENDS")).click();
    driver.findElement(By.linkText("See All Friends")).click();
    /*//Expand the friend list
    While(true);{
    try{
    WebElement seemore= driver.findElement(By.linkText("seemore"));
    seemore.click();
    Thread.sleep(5000);
    }catch(Throwable t){
    System.out.println("Expanded everything");
    break;
    }
    }*/
    WebElement Box = driver.findElement(By.xpath("//* [@id='collection_wrapper_2356318']"));
    List <WebElement> names = Box.findElements(By.xpath("//a[contains(@id=****)]"));
    System.out.println("No. of friends :"+ names.size());
    for (int i=0;i<names.size();i++){
    String frnds = names.get(i).getText();
    if(!frnds.trim().equals("")) {
    System.out.println(frnds);
    }
    }
    driver.findElement(By.linkText("Account Settings")).click();
    driver.findElement(By.xpath("//*[@id='logout_form']/label")).click();
    }
    }




asked 12 secs ago

DSL

14






How can i get the Friends list from Facebook? How to do this one? pls help me.How can i get the names xpath?

Aucun commentaire:

Enregistrer un commentaire