From previous posts we talked about Selenium WebDriver with JAVA.

From this post I’m going to talk, how to use WebDriver with python. Let’s see how to install Selenium on linux to use with python.

  • There should be pip installed, in order to install Selenium.


  • Next we can install Selenium using the pip.


  • Now Selenium has installed successfully and we can import selenium in our python projects.
  • I’m going  to run the following code to check the Selenium on python.


It’s almost same the code what we used in JAVA.

First I import webdriver from the selenium module.

Then I have created a new Firefox object.

Then I’m redirecting to the Google site.

find_element_by_id() will return the element find out by it’s ID.

send_keys() will send the hello text to the browser.

get_attribute() will take the value back to the code.

Then using the print() method I have printed the output to the terminal.

Then the browser window will be closed using the close() method.

  • Let’s see the output.



All the methods are same in JAVA and python, only the syntax will be changed. Hope you got an idea about how to use python and Selenium WebDriver together. See you soon. Thank You!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s