0

I am trying to find all the links of a webpage, but the webpage has multiple pop-ups which also contain links which cannot be seen without clicking them first when using inspect element.

Is there a way where I can get all the links on the webpage with selenium without having to click the pop-ups on the webpage?

Thanks

2
  • Can you show the code you've got so far? Can't image FindElements not working for this.
    – FDM
    Commented Sep 19, 2016 at 10:26
  • @FDM, my code is already finding all the links, I'm using By.TagName("a"). The thing is that on the website there more than 8 pop-ins in which there are more links that I have to use. The href is blank when I inspect the element (i.e `href=""). Also the pop-in is in a data-reactid. Commented Sep 19, 2016 at 13:39

1 Answer 1

1

For finding all links

List elementList = new ArrayList();
elementList = driver.findElements(By.tagName("a"));

For any action which requires to be done on pop up. You should switch to pop up window.

So now you have to basically jump to all the pop ups after finding all links on the main page and then you can find the links.

For finding href which as null means its is not a clickable element.

Let me know if you need code how to find all the pop ups

2
  • thanks a lot for the help. Do you know how can I tackle pop-in on a single page itself? and yes It will be great if you can help me with the code Commented Sep 20, 2016 at 11:06
  • can u give me the url. currently dont have any website like u mentioned to try this out
    – rishav
    Commented Sep 21, 2016 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.