(this is my learning notes on Selenium)
Selenium (software) is a software to automate testing web sites. Basically, it simulates opening a web page, clicking, login, etc.
Selenium is a bit confusing. It has many different parts. Here's a summary:
What is Selenium IDE?
• Selenium IDE (aka Selenium Recorder). (http://docs.seleniumhq.org/projects/ide/) is basically a recording tool (Firefox Add-On) for Firefox web browser. It lets you record clicks, etc and play it back. Good for learning Selenium, and useful for creating bug reproduction steps. This is the most basic tool, the origin of Selenium.
the selenium IDE is very simple and toy-like. You can just start to use it, play with its buttons.
What is Selenese?
Selenium Remote Control?
• Selenium Remote Control. (aka Selenium RC, Selenium 1) This is deprecated. Don't worry about this.
• Selenium WebDriver (Selenium 2). This basically the engine of Selenium. Available for all major browsers. The scripts in various languages calls Selenium API and talks to this WebDriver, and it in turn talks to the browser. This WebDriver was originally a different product, menat to be a standard for browser, and is in the process of becoming a w3c standard. See http://www.w3.org/TR/2013/WD-webdriver-20130117/
Selenium Client API?
thnigs to try.
click on the record (red button) to start recording. (after you click on the record button, then, go to browser, let's say gmail.com, and try to login, after you login, switch back to the s ide and click stop recording.)
double click on a command runs that command.
click on the source tab to see the source code for your test.
right click on te “untitled *” under the left “Test Case” panel. You can name the test, and you can save the disk to disk. Try it.
Saving the Test
you can save the test as a standard SE xml file. Just go to File menu. the test file is basically just a HTML table.
this is the same as you click on the Source tab.
you can also save the test as a API webdrive script for Ruby, Python, etc. Just go to file menu and chose export.
- assert → product failed
- verify → test failed
you can right click on a web page to see all all the s commands.
download chrome driver blob at https://code.google.com/p/selenium/wiki/ChromeDriver
to use chrome driver, do
import os from selenium.webdriver.chrome import options as chrome_opt # driver = webdriver.Firefox() driver = webdriver.Chrome(executable_path=os.path.join(os.getcwd(), "testing2/selenium/chromedriver"))
HtmlUnit is a browser without a GUI interface. It's written in Java.
HtmlUnit home page @ http://htmlunit.sourceforge.net/
Official Selenium IDE tutorial @ http://docs.seleniumhq.org/docs/02_selenium_ide.jsp
Selenese (Selenium IDE commands) reference @ http://release.seleniumhq.org/selenium-core/1.0.1/reference.html. local copy: Selenium Reference
Selenium WebDriver into http://docs.seleniumhq.org/docs/03_webdriver.jsp
Selenium WebDriver Python API http://selenium.googlecode.com/git/docs/api/py/api.html.
Selenium WebDriver Python API (seems a older version) http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html#documentation