Welcome to the world of automation!
With Selenium we can automate some interesting tasks in our browser. For instance, we can automate things like check the email. Are you ready?
First of all, we have to start talking about the Libraries we are going to import, to do so we can type:
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # availa
ble since 2.4.0
from selenium.webdriver.support import expected_conditions as EC
# available since 2.26.0
import os
import json
import urllib2
import sys
import time
Now we can declare our object DRIVER, how?
driver = webdriver.Firefox()
Have in mind driver is a variable we have defined in the import section, so no need to defined it. And as you are thinking, we are going to work with Firefox. Better!
So how do we open a web page with Selenium? We have to use the GET method:
driver.get("http://www.google.com")
So the result of this is that you will be shown a firefox page with the google page loaded.
No problems, right?
More next time!
But how do I execute this?
We are going to execute this examples in the command line like this:
$python example.py
Where example.py is a text file with some Python code in it. Python is the programming language we are going to use but you can use others like Java.
BTW: In order to get everything working, you need to download the gecko engine, you can do that from its Github repository.
Share your doubts about this awesome world?