Interview Questions, Answers and Tutorials

Selenium Tutorial

Selenium Tutorial

Components of Selenium: a. Selenium IDE – Plugin to Firefox to record and playtests in firefox and also export tests in different languages. The most appealing format is the HTML test case which seems to based on fit HTML.
b. Selenium RC- Allows playing of exported test in different platforms/OS.
c. Selenium Grid – Allows controlling lots of selenium machines.
Selenium RC Tutorial: Selenium RC is a Java-based command-line server that starts browsers and runs commands you pass from your tests.

Steps to set up the Selenium tool and execute the test case:

1. Install Selenium IDE

2. Record a test case using Selenium IDE in firefox and Export file as “PHP selenium RC” with filename Example.php

3. Open PHP file in notepad and verify that the following code should be displayed:


Last line Complexity in the code – ‘$this->getText…’. The function ‘getText’ returns the text found at the element specified in the expression. The complex-looking line is an XPath expression.

An easy way is to use the XPather Firefox addon to get the XPath of any element on a page. After you download and install the addon, restart Firefox, right-click on any element, and from the context menu select ‘Show in XPather’. XPather retrieves the XPath to the specified element, which you can then use in your test code.

4. Download and Install Java Runtime

5. Downloaded Selenium RC

6. Start the Selenium RC server by typing the “java -jar selenium-server.jar” command in the command prompt.

7. Now the server is ready to accept test commands from your PHP script. Make sure you keep this server running till you finish testing.

8. Download and Install WAMP and PHPUnit on Windows.

a. Once you have installed and setup WAMP, open up the command prompt and go to your PHP directory in WAMP [C:/> cd wampbinphpphp5.2.5]

b. From here you must run the go-pear.bat file to install PEAR and all the files needed for it [C:wampbinphpphp5.2.5>go-pear.bat]

c. When executed PEAR will ask you a series of question to set itself up correctly if you don’t know what your doing then just accept the defaults.

d. Once installed you must run the PEAR_ENV.reg which will create the environment variables for the user so that PEAR can be called in any directory on the command line [C:/>wampbinphpphp5.2.5/PEAR_ENV.reg].

e. It should work but if you cannot call PEAR from the command prompt, then you must manually add the directory to the path in the Environment Variables list, found in System Properties -> Advanced-> Environment Variables, then add the directory [C:wampbinphpphp5.2.5 to the PATH variable].

f. Once you have PEAR setup, then you must register the PHPUnit channel with PEAR [C:/>wampbinphpphp5.2.5/pear channel-discover pear.phpunit.de].

g. Now you can use the PEAR to install packages from the PHPUnit channel [C:/>wampbinphpphp5.2.5/pear install PHPUnit/PHPUnit]

9. Copy and paste the “Example.php” file in the PHP folder [C:/>wampbinphpphp5.2.8]

10. Open another command window and write [cd wampbinphpphp5.2.8]

11. Run command [phpunit Example]

6 thoughts on “Selenium Tutorial

  1. I am comparatively new to selenium and played a little with selenium IDE, and trying to do with selenium rc. I am baffled to use the scripting language there. Can you tell me what is the most used language in selenium across industries? And also I came across this course http://www.wiziq.com/course/12451-selenium-automated-web-browser-testing-for-web-applications os selenium automated web browser testing is this good? If someone does in Java and he joins a company where everyone does in ruby, then it'll be a pain to learn ruby again. And also it would be great if you address any comparison about the available languages like (perl, python, ruby, java etc.) or tell me any other guidance would really appreciate help and also i would like to thank for all the information you are providing.

  2. It's very useful article with informative and insightful content and i had good experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Go through some helpful and rich content Salesforce Admin syllabus from learn in real time team. This Salesforce Development syllabus is 100% practical and highly worth reading. Recently i have gone through Salesforce Development syllabus and Salesforce Admin syllabus which includes Salesforce training in USA so practically designed.

Comments are closed.