Selenium Tutorial

Components of Selenium: a. Selenium IDE - Plugin to Firefox to record and play test 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 platform/OS.
c. Selenium Grid - Allows to control 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 selanium RC” with filename Example.php

3. Open PHP file in notepad and verify that 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 than use in your test code.

4. Download and Install Java Runtime

5. Downloaded Selenium RC

6. Start the Selenium RC server by typing “java -jar selenium-server.jar” command in 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 wamp\bin\php\php5.2.5]

b. From here you must run the go-pear.bat file to install PEAR and all the files needed for it [C:\wamp\bin\php\php5.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:\wamp\bin\php\php5.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:\wamp\bin\php\php5.2.5 to the PATH variable].

f. Once you have PEAR setup, then you must register the PHPUnit channel with PEAR [C:\wamp\bin\php\php5.2.5>pear channel-discover].

g. Now you can use the PEAR to install packages from the PHPUnit channel [C:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit]

9. Copy and paste the “Example.php” file in php folder [C:\wamp\bin\php\php5.2.8]

10. Open another command window and write [cd C:\wamp\bin\php\php5.2.8]

11. Run command [phpunit Example]


Unknown said...

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 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. said...

This for your valuable comment and for your query, you need to follow the below shared link

Deepika said...


NO.1 AQM Services | Application Quality Managment Services | Austere Technologies

Deepika said...

wow...nice blog, very help full information. Thanks for sharing.

Best Digital Transformation Services | DM Services | Austere Technologies

Deepika said...

Excellent informative blog, keep for sharing.

Best System Integration services | Massil Technologies