Using if / else in selenium ide

余生长醉 提交于 2019-11-27 22:54:39
Petr Janeček

You'll have to download the Flow Control plugin for Selenium IDE from the official page (aaaall the way down).

The most useful link I found is this one, because it has a complete example in it: http://selenium.10932.n7.nabble.com/if-else-statement-td4370.html

Anyway, there's also a documentation and author's blogpost explaining something more.


The only alternative I know about is implementing the whole logic in javascript - including the test steps. It's possible, it's a little bit harder to get right, but if you'll end up stuck with IDE without plugins, it might be your only save:

var value = this.browserbot.findElement("id=someInput").value;
if (value == "Slanec is the best!") {
    this.browserbot.findElement("id=someButton").click();
}
bobafett

Try this:

**storeTextPresent || [some_value] || [variable_name]**

**gotoIf || storedVars['variable_name']** == true || **goto_label_name**

// Command to execute if the condition is not met

**label goto_label_name** 

// This is where the script will jump to when // Command to execute if the condition is met, this part may be off course unrelated to the initial condition

You'll need to have installed the Flow Control plugin for Selenium IDE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!