0

I am using the seleniumIDE

I want a Test Case to go to another location based on a condition (note: the condition part is why I am using javascript and using the if-then plugin is not an option for now). I have found that even javascript{window.location.replace('http://google.com') } closes my seleniumIDE window and replaces it with google but doesn't affect the actual window where the tests themselves were running. I've replaced the condition itself with 1==1 i.e. true. to be simple

Right now I have:

Command  store
Target   javascript{if (1==1) {location="dmstaffing-stage.herokuapp.com/users/sign_out"}}
Value    ignore_me

The problem right now is that this is closing the the seleniumIDE itself and opening a new window.

How can I change the URL location of the window where tests are running

Using:

  • this.location.href gave an unexpected Exception
  • document.location.href closed my selenium window and then opened a new window and visited the logout page (but original page in original window still logged in)
  • location.href also closes my selenium window and open a new window with the logout action
4

1 回答 1

0

可以做到,但需要一些魔法。在目标中使用 this.browserbot.openLocation。例如 this.browserbot.openLocation(' http://blog.reallysimplethoughts.com/ ');

Command  storeEval
Target   this.browserbot.openLocation('http://blog.reallysimplethoughts.com/');
Value    ignore_me

您可能想查看Sel Blocks v1.3.1并在正常打开命令周围使用 if/else。

于 2013-07-30T22:39:46.270 回答