Script for fetching links on Page

15 views
Skip to first unread message

roger....@ithands.biz

unread,
Oct 22, 2018, 6:29:46 AM10/22/18
to Selenium Users
Hi, 

Currently, I want to access all the links on the page. 


This is the script im executing 

  

        driver = new FirefoxDriver ();

        driver.manage().window().maximize();

         driver.get(homePage);

        

List<WebElement> links = driver.findElements(By.tagName("a"));

        

 Iterator<WebElement> it = links.iterator();

       while(it.hasNext()){



            url = it.next().getAttribute("href");

            

            System.out.println(url);



But im not getting the list of the following link on page  -> https://testingteam359002401.wordpress.com/testing-page-2/ .   i.e.

Thanks 


Reply all
Reply to author
Forward
0 new messages