Reputation: 89
I've searched previous posts and have not been able to find a solution, so I would try a new post.
I have a simple login page in which upon pressing the button it sends you to a new window. I am trying to select this new window and then assert its title, but Selenium IDE cannot find the Window with the title.
Here is the HTML code for the title of this new window...
<head><title>
Pharma Unified Access: Main Menu
</title>
My Selenium code is simple.
<tr>
<td>selectWindow</td>
<td>Pharma Unified Access: Main Menu</td>
<td></td>
</tr>
<tr>
<td>assertTitle</td>
<td>Pharma Unified Access: Main Menu</td>
<td></td>
</tr>
I receive the following message...
I used storeallwindownames/ids/title and Selenium does not even recognize the existence of the new window because it only gives me the name/title/id of the original window? How do I make Selenium IDE recognize the existence of this new window?
Any help would be much appreciated.
Upvotes: 0
Views: 2470
Reputation: 173
The issue you are facing is that there is a bug in selenium IDE where it can only recognize windows that IT opened. You are unable to select the new window with "selectWindow" because Selenium IDE did not "Open" the window. It "clicked" on the link, and the webpage "opened" the window.
The workaround is to use storeAttribute on the hyperlink element pointed @href to extract the url from the link and store it as a variable. Then use openWindow. So instead of:
<tr>
<td>click</td>
<td>//table[@id='dtgList']/tbody/tr[1]/td/a/u</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>10000</td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>Profile</td>
<td></td>
</tr>
Use this tactic:
<tr>
<td>storeAttribute</td>
<td>//table[@id='dtgList']/tbody/tr[1]/td/a@href</td>
<td>Profile</td>
</tr>
<tr>
<td>echo</td>
<td>${Profile}</td>
<td></td>
</tr>
<tr>
<td>openWindow</td>
<td>${Profile}</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>10000</td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>Profile</td>
<td></td>
</tr>
Hope that helps.
Upvotes: 0
Reputation: 3203
If you happen to have the window ID, you may try this:
<tr>
<td>openWindow</td>
<td></td>
<td>windowID</td>
</tr>
<tr>
<td>assertTitle</td>
<td>Pharma Unified Access: Main Menu</td>
<td></td>
</tr>
This command is suggested as a workaround for bug SEL-339.
Upvotes: 0
Reputation: 2357
Do you have access to edit the HTML code. It may be the case that there are hidden characters in the title such as \n newline or \t tab.
Would you be able to change the HTML code to Pharma Unified Access: Main Menu or failing that try adding wildcards to cover any hidden characters.
<tr>
<td>selectWindow</td>
<td>*Pharma Unified Access: Main Menu*</td>
<td></td>
</tr>
Upvotes: 0