Posts

Showing posts from October, 2021

sample code to retrieve webpage contents using selenium

Image
Selenium webdriver is primarily it is for automating web applications for testing purposes, but has also gained popularity to scrape content from dynamic webpages that contain javascript and retrieve content on the fly when the webpage is loaded. Such webpages cannot be scraped using native solutions in most programming languages, since the query and the result take place when an action is performed is difficult to mimic in the out of the box solutions. There is where Selemium comes in handy and helps fire the action that initiates the query and captures the response when it comes through. An example of this can be found in the current blogpost, where we will see the behaviour of a popular webpage that loads content on the fly, and how selenium webdriver can be used to extract the information we need. Let's say that one needs to extract the results of the matches and match links for all matches in the 1999/00 season from the Premier League website, the link to which is here . The