Selenium IDE – How to follow links that open a new window
9While building another test case, I ran into a situation that wasn’t working with the standard point and click navigation. Clicking on a dynamic link opened a new window where I needed to continue my test, but selenium didn’t follow the newly opened window. There are a few ways to do this, but what made this one difficult was that the link and new window was a dynamic url each time.
The fix was to store the link in a variable, then open the variable link with selenium using “open”. To store the variable I used “storeAttribute” and the target used xPath to grab the hyperlink’s href attribute from the url and save the variable as “ticketUrl” as in the image below:
Hi I'm Nick Bartlett and thanks for visiting my blog. I'm not much of a writer; many of my posts are short and to the point while others are meant to be a reference for myself and other web developers.
Thanks for this tip. This one has been driving me crazy all day. It’s not as good as testing that the link opens in a new window, but at least I can now write a test to check that it goes to the right url.
Thanks for this, I have just realised I have been downloading the same file after doing a MD5 check on them. The problem I had put in the absolute URL yet the filename / link changes with time. Hopefully this will resolve the issue.
Many thanks
G
Simple and functional. Excellent post. Thank you
Hi,
This is exactly, what i am looking for.
Excellent topic, very much useful for selenium users
thank u very much.
Hey.. U have been a life -saver .. was looking for something like this !!!
Thx a lot !!!!
Thank you very much for this post!
I’ve been looking for a way to do this in Selenium this morning and was ready to give up thinking that it wasn’t possible until I found this post.
while trying this i am getting error.
# ] Executing: |storeAttribute | //a[@id=' http://ribadmin:ribadmin1@mspdev84.us.oracle.com:19102/rib-rms-admin-gui/index.jsp'@href | nwin |
# [error] Element //a[@id=’ http://ribadmin:ribadmin1@mspdev84.us.oracle.com:19102/rib-rms-admin-gui/index.jsp' not found
Please help me
Now, the real kicker is how do you get to the new window that is lunched by clicking the submit button on a form where the button is simply
and the forrm action
and the page is simply the a online xml file
returned from the soap api call
3495
whoops did not do the replaces before I hit return…
Now, the real kicker is how do you get to the new window that is lunched by clicking the submit button on a form where the button is simply
<input type=”submit” value=”Invoke” class=”button”>
and the forrm action
<form target=”_blank” action=”http://authservice.mysite.com/Accnt/Keys.asmx/Key.Create” method=”POST”>
and the page is simply the a online xml file
returned from the soap api call
<int xmlns=”http://www.mysite.com/response”>3495</int>