Selenium Automate Testing Example
Windows Platform
-
install vc redist (Microsoft Visual C++ 2010 Redistributable Package)
-
install python 2.7 (http://www.python.org/download/releases/2.7/)
-
add path to python 2.7 and scripts and openssl (C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages;)
-
install pywin (http://sourceforge.net/projects/pywin32/files/pywin32/ select latest build and select correct python version)
-
install python setuptool (https://pypi.python.org/pypi/setuptools/0.9.6#installation-instructions)
-
easy_install pip
-
pip install selenium
-
pip install behave==1.2.2 NOTE: do not use version 1.2.3 or above -- there is an issue with Thai language.
-
pip install colorama
-
extract ansicon and run ansicon -i (check 32 / 64 bits version)
- You can download it here: https://github.com/adoxa/ansicon/downloads
- Read the detailed instructions here: http://www.kevwebdev.com/blog/in-search-of-a-better-windows-console-using-ansicon-console2-and-git-bash.html
- Focus at section "ANSI escape sequence support with ansicon"
-
Git clone ProjectCylon
-
Install Thai Font for CMD
- extract ThaiLang4CMD.zip
- install font Courmon.ttf to windows fonts folder
- run ThaiLangInDOS.reg
- restart machine
- run cmd windows and set font to courier mono thai and set font size to 24
-
Make Python able to run Thai
-
edit C:\Python27\Lib\site.py
-
find the following 2 rows and comment them out:
- #if hasattr(sys, "setdefaultencoding"):
- #del sys.setdefaultencoding
-
create sitecustomize.py file at C:\Python27\Lib\site-packages with the following content
- import sys
- reload(sys)
- sys.setdefaultencoding("utf-8")
-
-
Change Language for non-Unicode program to Thai (Region and Language -> Administrative -> Language for non-Unicode program)
-
Restart machine
- sudo easy_install pip
- sudo pip install behave
- sudo easy_install selenium
- git clone https://github.com/pongrapee/ProjectCylon
- clear all .py files in \pageobject\ (except init)
- edit csv files in \pageobjectdefinition\
- run GenAllPageObject.bat
- run CheckElements.bat to check pageobject
- edit features file in \features\ (format and example: http://pythonhosted.org/behave/tutorial.html#feature-files)
- edit steps file in \features\steps\
- run RunBDDColor.bat to check test
- edit csv files in \pageobjectdefinition\
- edit features file in \features\ (format and example: http://pythonhosted.org/behave/tutorial.html#feature-files)
- edit steps file in \features\steps\
- ./Run.sh (for generate->check_element->run)