Reputation: 1113
I've been working with Selenium IDE and have a test script, which uses both 'click' and 'Clickandwait' commands. When running this script multiple times, these steps are behaving inconsistently in the way the link opens. Sometimes the link opens in the same window, which is expected for the site I'm testing on. But sometimes the link opens in a new window when using the exact same test case/step as before, which is causing my test case to fail.
Has anyone else encountered this? or know what could be causing it?
Upvotes: 0
Views: 154
Reputation: 31
You could just use a store command to take the href attribute from the link and use it in an open window command. It's not the cleanest way of doing it, but it should give you more consistency.
Upvotes: 3
Reputation: 36
Could be to do with your browser settings, try looking for the option which says something about firefox opening links in new tabs and make sure it's de-selected
Upvotes: 2
Reputation: 3635
I've never seen situation like this, but i think you can handle it by using few available functions.
Use waitForPopUp
and then selectPopUp
to switch focus to the new tab.
All your operation will take place in new window. Use close
to close newly opened window and then, use selectWindow
to select your original window.
How to handle situation when you don't know if popUp showed up?
Use gotoIf
function enabled from goto_sel_ide.js
.
Write a line of code which consists:
storeElementPresent css=elementfromcurrentwindow customVariable
gotoIf ${customVariable}==true currentWindow
gotoIf ${customVariable}==false popUpWindow
label currentWindow
//instructions
go to AfterWindows
label popUpWindow
selectPopUp
//instructions
close
selectWindow
label AfterWindows
Hope it helps!
Upvotes: 0