#100DaysOfCode in Python Transcripts
Chapter: Days 73-75: Automate tasks with Selenium
Lecture: Concepts: what did we learn
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Right, let's review what we've learned so far.
0:03
The most basic example
0:05
of Selenium, the hello world, so to say.
0:08
You create a driver object.
0:10
You go to python.org.
0:12
You find the search field, named queue.
0:14
You populated the data and we submit it by hitting return.
0:20
We saw that Selenium actually opens your browser.
0:22
You see it doing it in real time which is pretty cool.
0:31
And here we make assertions based
0:34
on the page source that changed after the action.
0:38
Now we're going to do a more fun and practical example,
0:41
scraping my Packt account which you see here
0:43
in the logged in state.
0:47
We retrieve the login URL and loaded user and password
0:50
from the environment variables
0:52
and send them to the login form.
0:54
We submitted the form by hitting enter.
0:58
Then we found the My eBooks link and clicked it
1:01
to actually go to the my eBooks site you see at the left.
1:05
We identified the HTML that contains the books
1:08
and did some parsing to get all the titles and their ids.
1:12
And this is pretty cool to further extend
1:14
to make a download app or whatever.
1:17
And the second app was the PyBites banner generator
1:21
which we fully automated using Selenium.
1:24
Again, we logged in with the credentials.
1:29
We found the corresponding HTML.
1:31
In this case, we had to populate the form
1:34
to send data to the server.
1:38
And finally we closed the driver.
1:41
This led to an automated banner.
1:43
Awesome because, imagine you have
1:45
to create like 200 for some campaign.
1:47
Well, with Selenium, it becomes very easy.
1:51
And now it's your turn.
1:52
Keep calm and code in Python.