Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

gotoIf Function Use Empty gotoIf Function Use

Sat Mar 31, 2012 1:07 am
Can anyone give me an explanation on how to use the gotoIf function? Basically just some examples would really help. I understand the while function really well and have been using it for a lot, but I feel like the gotoIf function is more appropriate for some of these scripts.

Most of the stuff I have read shows it being used with labels and that is another thing I have struggled to understand. Any explanation of the usage of labels and this function separate and in conjunction with each other would be extremely beneficial.

Thanks,
Cameron
rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

gotoIf Function Use Empty Re: gotoIf Function Use

Sat Mar 31, 2012 1:13 pm
Code:
open  | google
storeTextPresent  | Google.co.in offered in: Hindi Bengali Telugu Marathi Tamil Gujarati Kannada Malayalam Punjabi  | title
gotoIf  | storedVars.title  | true
getEval | alert("Not a home page");
gotolabel | finish
label  | true
getEval | alert("home page");
label | finish

This is sample code with use of gotoif.
It will check whether title is present or not, if present control will redirect to label true, else will execute next statement after gotoif.

Let me know if any more help requires...
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

gotoIf Function Use Empty Re: gotoIf Function Use

Mon Apr 02, 2012 11:11 pm
Is getEval a valid command still? I am running IDE version 1.7.2 and I don't have that option. I have read that the runScript command is similar to getEval.


Can you explain what a label is? I am confused as to what it actually is and how it is used. I should know this by now, but I haven't grasped a good understanding of it yet

rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

gotoIf Function Use Empty Re: gotoIf Function Use

Tue Apr 03, 2012 11:34 am
lable is like step..if this scenario, if conditing is true then execute next step..in script you can see gotolabel | finish
What is means that, when IDE executes this command, it will redirect to label finish..Its just like step to follow..Or to move execution flow to any particular step we use label / gotolabel..
Are you aware of alogorithm?in that we follow same thing, like goto step 4 like that.label is just for understanding for IDE, how to jump of any step..

And regarding getEval, yes its still valid command for version 1.7.2

Let me know if you have any doubt.. Smile
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

gotoIf Function Use Empty Re: gotoIf Function Use

Thu Apr 05, 2012 5:24 am
That all makes so much more sense! Thanks for the help.

I did find getEval finally. For some reason it doesn't autocomplete the command.
rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

gotoIf Function Use Empty Re: gotoIf Function Use

Thu Apr 05, 2012 12:23 pm
yes true, it doesn't auto-complete the command, you need to type it completely.
Sponsored content

gotoIf Function Use Empty Re: gotoIf Function Use

Back to top
Permissions in this forum:
You cannot reply to topics in this forum