Selenium Webdriver – Automation with Python

By | 19/08/2014

Hi people,

today, i would like present an basic script example of Python for Selenium Webdriver.

first line is a general Python code to use any printable string in utf-8 (# -*- coding: UTF-8 -*-)

next line is import selenium webdriver module (from selenium import webdriver)

create a Firefox driver and assigned it to a variable to use in following lines(driver = webdriver.Firefox())

set up implicit and explicit waits

after open browser, most of times it is useful to make maximize it(driver.maximize_window())

get() function is starting point !!! we use this function to open a webpage. After that, we print title element of page by “title” command. Don’t forget to close your driver after complete your operations(driver.close()) .

you can find complete working code at below:

# -*- coding: UTF-8 -*-
from selenium import webdriver

driver = webdriver.Firefox()


print driver.title


Leave a Reply

Your email address will not be published. Required fields are marked *