Install Selenium Python In Ubuntu For Automation


Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way.

Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote etc. The current supported Python versions are 2.7, 3.5 and above.

Install Selenium Python

1. Install the latest stable version of Firefox:
sudo apt install firefox
2. Update
sudo apt-get update
3. Install Selenium
For Python2:
sudo pip install selenium
For Python3:
sudo pip3 install selenium
4. Check the latest release of Geckodriver on the releases page and download it
wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
5. Extract the archive and move the executable to a location in your PATH:
tar -xvf geckodriver-v0.19.1-linux64.tar.gz
sudo mv geckodriver /usr/local/bin/

Code test Selenium Python

Run python first:
python3
Code test:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup
import re
import pandas as pd
from tabulate import tabulate
import os
import time
import csv
import random
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.implicitly_wait(30)
url= 'vuinghichweb.blogspot.com'
driver.get(url)
driver.quit()

Have fun!

Post a Comment

0 Comments