In the Selenium IDE, you can test multiple sites by using Javascript variables to store the site URL. At the beginning of your test suite, create a test case which declares all of the variables:
<tr>
<td>store</td>
<td>http://www.google.com</td>
<td>main</td>
</tr>
<tr>
<td>store</td>
<td>http://finance.google.com</td>
<td>finance</td>
</tr>
In subsequent test cases, the first command should be open followed by the page which needs to be tested:
<tr>
<td>open</td>
<td>${main}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${finance}</td>
<td></td>
</tr>
Main considerations:
- These URL variables will be global to all of the test cases within your test suite.
- These variables will be stored in the IDE until you close / restart the IDE. This means you can open a new Test Suite and use the same variables again and again.
- Once you close the IDE, all stored variables will be gone.
If, as Siva mentioned, most of the XPaths will be the same (aside from the link href and text), you can double up on your test cases, one opening the first site and doing the verification, and the other one (exactly the same as the first) except it will open the second site and do the verification.
So to complete the example, if we wanted to verify that on both the main Google search page and on the Google Finance page the "+You" link is present, we can do the following:
<tr>
<td>open</td>
<td>${main}</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@id="gb"]//li[1]/a/span[2]</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${finance}</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@id="gb"]//li[1]/a/span[2]</td>
<td></td>
</tr>
If you copy and paste the first code example above into a test case, create a new test case, paste this last example into the second test case, and run the test suite, you will see that the IDE will:
- Open the Main Google page
- Verify the +You (based on the XPath)
- Open the Google Finance page
- Verify the +You (based on the same XPath as before)
The tricky part with this approach though, is that you have to craft the XPaths very carefully to be able to work on all the pages you need to test, but seeing as how it is the same site, just one is live and one is in staging, most of the XPaths should be the same, or at least very similar.
Hope this helps!