cancel
Showing results for 
Search instead for 
Did you mean: 

"Run This Routine" Greyed out in script mode

SOLVED
Highlighted
Occasional Contributor

"Run This Routine" Greyed out in script mode

Hey All,

 

Hello.  I have a block of code I want to reuse multiple times with a parameter on the "Test Items" page.  

It's for navigating to specific buttons on a nav bar.

 

When I run the test through the Test Items page (via right click + run Focused Test item) it works just as I expect, which is great...I can select the param as a string and put a value in and its good to go. 

 

but when Im editing in the script mode editor, I cannot do the "run this routine" option, and is making me think there is an error in the code somewhere? Its greyed out and apparently is suggesting to click Code Completion, which Im not sure what it's trying to do there. Any thoughts would be very appreaciated! 

 

I've isolated a small chunk and  thought if I made it this basic it would work, but no - it is still greyed out.  

 

function teleport(NEWPARAM) {
Indicator.PushText("Navigating to Blade...");
let navigate = Aliases.browser.page.nav
let navbar = Aliases.browser.page.header
//Clear any open blades
Aliases.browser.page.header.button3.HoverMouse();
delay(200)
Aliases.browser.page.header.button3.Click();
delay(200)
Log.Message(NEWPARAM);
}

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: "Run This Routine" Greyed out in script mode

The routine has a parameter.  You can't run a parameterized routine using the right-click context menu because you need to have some way of indicating the value of the parameter.  Work-around: create a "harness" function that, all it does is call your routine with the proper parameter value.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
5 REPLIES 5
Contributor

Re: "Run This Routine" Greyed out in script mode

You can't run function with parameters by 'Run this routine' action. 

Try to create an additional function to run need test manually from the script.

teleport_debug()

{

   teleport("myTestItem")

}

 

Occasional Contributor

Re: "Run This Routine" Greyed out in script mode

It appears I can run the routine when I'm on the Test items page, and if I make a keyword test with params then convert it to script mode it looks just like what I'm trying to do above.. so I'm not entirely sure.

 

Are you saying that I can achieve what I'm trying to do by making the params in a function INSIDE of a parent function? 

Community Hero

Re: "Run This Routine" Greyed out in script mode

Inside of a parent with no parameters I think is the point.  You can't run it the way you have it because there's no way to give it the parameters.

Occasional Contributor

Re: "Run This Routine" Greyed out in script mode

Ty I will try that! 

Community Hero

Re: "Run This Routine" Greyed out in script mode

The routine has a parameter.  You can't run a parameterized routine using the right-click context menu because you need to have some way of indicating the value of the parameter.  Work-around: create a "harness" function that, all it does is call your routine with the proper parameter value.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2