4 ms·
Logging Virtual Race Results with Selenium, Cron and Python
- loloquwowndueo 6y agoI prefer to use python-mechanize for this kind of “automate a human clicking their way through a web flow to do some stuff” work. It’s most useful for web page scraping but it would also work on this scenario - EXCEPT if the site in question relies on JavaScript to work, as mechanize can’t handle that. Selenium sounds like a good alternative if JavaScript is required, but it is more involved to set up and more resource-intensive. I didn’t see mention of whether the author looked into using mechanize, but it would have been an interesting thing to consider.
- kellyfoulk 6y agoI wasn't aware of python-mechanize, but I do seem to recall that the website in question relies on Javascript. Thanks for the suggestion!
- tonetheman 6y agoI would replace the time.sleeps in that code with webdriver waits... other than that this is a GREAT use case for selenium and automating boring things. Good write up.
- kellyfoulk 6y agoThanks for the recommendation, I was't aware of webdriver waits
- traverseda 6y agoI've run into some pretty big issues with selenium in the past, if python playwright works for you I'd recommend it. Seems a lot easier to work with these days. It's generally cleaner than selenium, has a few more features and is missing a few others.
- paulryanrogers 6y agoSelenium uses WebDriver and Playwrite looks to be the unofficial next generation of Puppet. Last I heard there are plans for a WebDriver 2 based on Puppet. So perhaps Playwright will positively influence that effort and someday Selenium too.
- chad_strategic 6y agoDo you write the python code or do you use the Selenium IDE to generate your python code?
- kellyfoulk 6y agoI write my python code