This selenium script demonstrates usage against an e-commerce site.
Pre-requisites:
- Firefox browser having Selenium IDE
- The pre-created test script is available
Test Steps:
- 1. on the PC, open up Firefox
- 3. on firefox, goto wordpress e-commerce site
- 4. open up the script below
- 5. run the selenium script
- 6. run the script again, and point out that the script can be run again and again
Conclusions
Related Entries
Solution:
Here is the screen of HTML script:
----------------------------------------------------
Here is the script 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 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://localhost/wordpress/wp-login.php" />
<title>Example1</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Example1</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/wordpress/wp-login.php</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>user_login</td>
<td>admin</td>
</tr>
<tr>
<td>type</td>
<td>user_pass</td>
<td>password</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>wp-submit</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//li[@id='menu-posts-wpsc-product']/div[3]/ul/li[1]/a</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=View</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>wpsc_quantity_update_174</td>
<td>3</td>
</tr>
<tr>
<td>click</td>
<td>product_174_submit_button</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td></td>
<td>300000</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=Go to Checkout</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Go to Checkout</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='checkout_page_container']/table/tbody/tr[3]/td[2]/form/input[2]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@id='checkout_page_container']/table/tbody/tr[3]/td[2]/form/input[2]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_9</td>
<td>Test1@we.com</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_2</td>
<td>Test360</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_3</td>
<td>Logica</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_4</td>
<td>J-223 Sec-22</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_5</td>
<td>Delhi</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_8</td>
<td>202302</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_18</td>
<td>9876543452</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_12</td>
<td>test</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_13</td>
<td>J-222 sec-90</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_14</td>
<td>Noida</td>
</tr>
<tr>
<td>type</td>
<td>wpsc_checkout_form_17</td>
<td>203301</td>
</tr>
<tr>
<td>select</td>
<td>how_find_us</td>
<td>label=Advertising</td>
</tr>
<tr>
<td>click</td>
<td>custom_gateway</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@name='custom_gateway' and @value='wpsc_merchant_testmode']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>agree</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@name='submit' and @value='Purchase']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Your Account</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a/span[@*]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
Helpful Video:
notes
ReplyDeleteupdate slide to point to wordpress install
i dont see the popup in the video/exercise.
notes:
ReplyDeletethis exercise needs to be redone.
the purpose is to create a script around buying something (ecommerce type script)
have a look to see if you can install a wordpress ecommerce plugin and then create a script to buy something
Exercise updated as per your comments, here is one thing to be done is "update slide to point to wordpress install".
ReplyDeleteNotes:
ReplyDeleteat the beginning of the blog entry, can you add the test steps that the test is trying to achieve. E.g. step 1 - goto url, step 2 - select an item, step 3 - add to basket. e.t.c
It's done.
ReplyDeleteNotes:
ReplyDeletethe focus of the exercise is the Test script and not the installation of the ecommerce plugin ( this is not what the delegates are here to learn).
Focus:
to create a test script to purchase something and to make sure the script can be run again and again with random values and random products.
Can you please change this so:
Pre-requisites:
1. test VM is available
2. the pre-created test script is available ( the delegates would create their own during the exercise)
Test Steps:
1. on the VM, open up firefox
3. on firefox, goto wordpress ecommerce site and run through the steps to record ( dont actually record anything)
4. open up a saved script
5. run the selenium script
6. run the script again, and point out that the script can be run again and again
Reply: Scripts and video are working same as you have defined in your test steps.
ReplyDeleteNotes: the test script does not look like it satisfies the focus from my comment:
ReplyDelete"to create a test script to purchase something and to make sure the script can be run again and again with random values and random products."
thanks got it, I will update.
ReplyDeletehere we need to select random products each time..
ReplyDeletehow do I connect to the wordpress site on http://localhost/wordpress/wp-login.php?
ReplyDeleteplease use this :
Deletehttp://foundation.time2test.co.uk/
however, the ecommerce plugin is not installed on the wordpres site at present. let me see if I can install it and then rerun the test.
regards
I have added a store plugin on the foundation.time2test.co.uk wordpress test site. It has been configured to use Paypal sandbox. Please create a script in a similar style to that in this example against that new setup.
Delete