Skip to content

Latest commit

 

History

History
44 lines (25 loc) · 1.09 KB

HOWTO-SELENIUM.md

File metadata and controls

44 lines (25 loc) · 1.09 KB

Installing Selenium for Chrome on IPC

Prerequisites:

  • Python, PIP installed
  • Chrome webbrowser installed

Steps

  1. Download WebDriver for approriate Chrome version from here

  2. Copy the executable to C:\WebDriver\bin

  3. Add the WebDriver location to PATH (using cmd.exe):

     setx /m path "%path%;C:\WebDriver\bin\"
    
  4. Install Selenium with PIP (also using cmd.exe):

     pip install selenium
    

Usage

Test if everything worked in Python console:

    from selenium import webdriver
    
    # Instantiate driver (opens browser)
    driver = webdriver.Chrome('C:\\WebDriver\\bin\\chromedriver.exe')
    
    # Open a website
    driver.get('http://www.google.com/');
    
    # Execute javascript
    driver.execute_script("javascript:alert('hi!');")
    
    # Close browser
    driver.quit()

References