r/pythontips • • Jun 17 '21

Python3_Specific Web Scraping With Selenium

I am currently learning selenium to bring my ideas to life. However, I couldn't use it on a site called "German Word of the Day"
Can someone help me scraping this page?
https://www.transparent.com/word-of-the-day/today/german.html

36 Upvotes

6 comments sorted by

14

u/didntreadityet Jun 17 '21

It looks like the problem is that the page is dynamically loaded. Once the initial HTML is present, it executes a script that loads the actual content.

In Selenium, you have to implement a wait (look for Selenium wait) to allow for the page load to occur.

6

u/brknarsy Jun 17 '21

Wow, thanks for this info. I wouldn't probably notice that!

5

u/Mynameismg Jun 17 '21

You can also get the data in XML format from: https://wotd.transparent.com/rss/de-widget.xml?t=1623946807770

Which wouldn't require using Selenium, which will make the scraping a lot faster

3

u/brknarsy Jun 17 '21

Thank you, sir! This is LOT EASIER than using selenium and struggling to find the elements.

5

u/CraigAT Jun 17 '21

What code have you tried? You can either paste it here if small or put in GitHub or PasteBin and link to it here.

Automate The Boring Stuff has a decent example or two to get you started, if you have not used Selenium before.