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

gotoIf Function Use

on 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
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: gotoIf Function Use

on 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...

_________________
Radical QA
http://radical-qa.blogspot.in/
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Re: gotoIf Function Use

on 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

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

Re: gotoIf Function Use

on 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

_________________
Radical QA
http://radical-qa.blogspot.in/
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Re: gotoIf Function Use

on 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.
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: gotoIf Function Use

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

_________________
Radical QA
http://radical-qa.blogspot.in/
Sponsored content

Re: gotoIf Function Use

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