Install automated testing environment

Note: these install instructions are windows-specific, but it’s the same on mac other systems too.

How will this work : we use Chrome to conduct testing, and Firefox to design the tests (chrome does not have an IDE for Selenium).

For our friendly Romanian colleagues: am facut tutorialul acesta de mana, nu este copy-paste de nicaieri, asa ca citeste-l cu atentie 😉

  1. install python (from https://www.python.org/downloads/)
    1. use custom install
    2. tick “Add Python to environment variables”
    3. remember where you’ve installed it 😉
  2.  install selenium using pip (which came with python)
    1. run this in console: path-of-python-that-you-remember-from-step-1.3/Scripts/pip install selenium
    2. close the console (!!!)
  3. test python
    1. open a new console (!!!)
    2. type in “python” and hit enter -> check if you are now in the python console
    3. exit the python console
    4. create hello.py and put this inside: print(“Bãi!”)
    5. save and exit
    6. run it from console: python hello.py -> check if it works
  4. install chrome driver
    1. download from https://chromedriver.storage.googleapis.com/index.html?path=2.25/
    2. save in python/Scripts
  5. test automation in chrome
    1. create and save this script as test1.py:
      from selenium import webdriver
      from selenium.webdriver.common.keys import Keys
      
      driver = webdriver.Chrome()
      driver.get("http://www.python.org")
      assert "Python" in driver.title
      elem = driver.find_element_by_name("q")
      elem.clear()
      elem.send_keys("pycon")
      elem.send_keys(Keys.RETURN)
      assert "No results found." not in driver.page_source
      driver.close()
    2. run it from console: python test1.py
  6. at this stage you should have a working python and selenium installation, if all the above tests were ok
  7. Install Selenium IDE for firefox
    1. go to https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/
    2. click the + Add to Firefox button and confirm
    3. restart firefox
    4. Selenium IDE is now available in the menu Tools/Selenium IDE or Ctrl+Alt+S

About

Software Development Manager, Architect

Categories: Automated testing |

Leave a Reply

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

[TOP]