Jose George
Jose George

Reputation: 1

how to fetch the links of ALL webpages (not just of the page in which the driver is present) via Selenium?

I am trying to fetch all links present in ALL webpages, but when I use "List<WebElement> links = driver.findElements(By.tagName("a"));" this fetches only the links of the current page. Is there any way to get all links of n-number of pages at once? or is this not possible at all?

Upvotes: 0

Views: 24

Answers (1)

sahil goyal
sahil goyal

Reputation: 13

Jose, this is not possible. Selenium has information about the current page only and not the previous or last page.

The only way to fetch all links is to visit all pages one by one. I hope this answers your query.

Upvotes: 1

Related Questions