DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Browser Auto Test


Selenium is a popular browser automation tool, which mainly used for UI auto test.

Python Client on Linux Mint

Follow the instructions on Python API docs in the section Selenium Client & WebDriver Language Bindings on Download page of Selenium website.

First download Firefox drivers for Linux 64bit: geckodriver-v0.20.1-linux64.tar.gz. Extract geckodriver and put it in a folder in $PATH, for example ~/.local/bin. Make sure the firefox executable is in the $PATH, and the terminal is attached with a DISPLAY. If not, start ipython with valid PATH and DISPLAY, for example: PATH="$PATH:$HOME/apps/firefox" DISPLAY=:10.0 ipython. Here DISPLAY is a session with X session. On Windows the simplest way is ssh to the server with MobaXterm. Search MobaXterm in dsnote Writing Documents with LaTeX on Ubuntu Server for details.

Then install selenium Python client and run a demo:

conda create -n browsertest python=3.5
conda install -n browsertest -c conda-forge selenium
conda install -n browsertest ipython
. activate browsertest
ipython
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
>>> browser.get('http://baidu.com')
>>> browser.quit()


Published

Apr 27, 2018

Last Updated

Jun 12, 2018

Category

Tech

Tags

  • browser 4
  • mint 24
  • python 136
  • selenium 2

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor