Aim:
Ensure that Java and selenium RC is installed and working and then run your first Selenium RC script.Difficulty level: Easy/Medium
What you will learn?
- Check installed java version
- Check that Selenium RC is installed and available
- Execution of Selenium RC via command line
Tips:
1. Use the below test cases or test suite or alternatively use your own test example
2. Create the command in Notepad++ and then paste into the command prompt.
Pre-requisites:
- Installed Java.
- Selenium RC
- Internet Connection
- Can access Wordpress.com and is familiar with How to works on Wordpress.com?
Exercise Steps
1. via command line, use "java -version"
2. via command line , use "java -jar selenium-server.jar"
3. copy and paste the below test suite and test scripts or use your own test suite
4. execute the Selenium RC command against firefox
"java -jar selenium-server.jar -htmlsuite <browser type> <url> <test suite> <result file>"
Zip file location: ( download from here)
C:\foundationSelenium\Ex6\testcase1.html, C:\foundationSelenium\Ex6\testcase2.html, C:\foundationSelenium\Ex6\testcase3.html, C:\foundationSelenium\Ex6\Solution2Suite.html, C:\foundationSelenium\Ex6\command.txt.
Commands
Java version:
>java -version
Launch Selenium RC:
>java -jar selenium-server.jar
For Result TestSuite:
>java -jar selenium-server.jar -htmlSuite "*firefox" "http://foundation.time2test.co.uk/" "C:foundationSeleniumEx6Solution2Suite.html" "C:foundationSeleniumEx6Result.html"
Solution:
here is the screen of test suite:
here is the test suite in HTML texts:
-----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="testcase1.html">testcase1</a></td></tr>
<tr><td><a href="testcase2.html">testcase2</a></td></tr>
<tr><td><a href="testcase3.html">testcase3</a></td></tr>
</tbody></table>
</body>
</html>
------------------------------------------------------------
here is the screen of included test case1:
Here is the script in HTML texts which is included as first test case in suite:
--------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://foundation.time2test.co.uk/" />
<title>TestCase1</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestCase1</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Log in</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Username</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Password</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=user_login</td>
<td>admin</td>
</tr>
<tr>
<td>type</td>
<td>id=user_pass</td>
<td>time4test</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=wp-submit</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='user_info']/p/a[2]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
--------------------------------------------------
here is the screen of included test case2:
Here is the script in HTML texts included as second test case in test suite:
-------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://foundation.time2test.co.uk/" />
<title>TestCase2</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestCase2</td></tr>
</thead><tbody>
<tr>
<td>clickAndWait</td>
<td>link=Posts</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='wpbody-content']/div[3]/h2</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Add New</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=title</td>
<td>javascript{"Post" + new Date().getMilliseconds();}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=publish</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=#menu-posts > div.wp-submenu > ul > li.wp-first-item > a.wp-first-item</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Post Tags</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='col-left']/div/div/h3</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=tag-name</td>
<td>NewTag</td>
</tr>
<tr>
<td>type</td>
<td>id=tag-description</td>
<td>This is new tag........</td>
</tr>
<tr>
<td>click</td>
<td>id=submit</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
----------------------------------------------------
here is the screen of included test case3:
Here is the script in HTML texts which is included as third test case in test suite:
---------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://foundation.time2test.co.uk/" />
<title>TestCase3</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestCase3</td></tr>
</thead><tbody>
<tr>
<td>clickAndWait</td>
<td>link=Users</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Users</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//li[@id='menu-users']/div[3]/ul/li[2]/a</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=user_login</td>
<td>javascript{"TestUser" + new Date().getMilliseconds();}</td>
</tr>
<tr>
<td>type</td>
<td>id=email</td>
<td>javascript{"TestUser" + new Date().getMilliseconds()+"@yahoo.com";}</td>
</tr>
<tr>
<td>type</td>
<td>id=first_name</td>
<td>TestFirst</td>
</tr>
<tr>
<td>type</td>
<td>id=last_name</td>
<td>TestLast</td>
</tr>
<tr>
<td>type</td>
<td>id=url</td>
<td>http://www.google.com/</td>
</tr>
<tr>
<td>type</td>
<td>id=pass1</td>
<td>time2test</td>
</tr>
<tr>
<td>type</td>
<td>id=pass2</td>
<td>time2test</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=addusersub</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Log Out</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
-----------------------------------------------------
Helpful Video:
notes
ReplyDelete1.should show installation of java
2.should show install of selenium rc
3.should then show the selenium rc working against the previously created suite.
Now video file is updated with your suggested points.
ReplyDeleteNotes:
ReplyDeletecan you please note down the key steps of the video.
notes
ReplyDeletecreate a new blog entry to show "how to isntall Selenium RC/ webdriver"
need to put the commands used in the video as code snippets on the blog entry.
Create a new blog entry to show "how to install java run time only"
change this exercise to show verify java installed and selenium webdriver installed only and then the running of the selenium webdriver test.
NOtes:
ReplyDeleteI cant see the code snippet for hte suite.
Notes:
ReplyDeleteneed to show the command as a code snippet in this blog.
Done
ReplyDeletefeedback:
ReplyDeletewhat do you mean by done - please expand based on my feedback notes.
Notes for viresh:
ReplyDeleterename the exercise to "run your first selenium RC script". take out the installation part and replace with verify that java and selenium rc is installed on the VM.