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

  • Can you show the code you've got so far? Can't image FindElements not working for this. – FDM Sep 19 '16 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. – albertgeorge253 Sep 19 '16 at 13:39
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

  • 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 – albertgeorge253 Sep 20 '16 at 11:06
  • can u give me the url. currently dont have any website like u mentioned to try this out – rishav Sep 21 '16 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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