+1 vote
hi team,

thanks for Your support in advance,

Please share the sample which includes Javascript and qa pro script calling that Javascript .

In help its not elabrated with sample

whether the javascript should be written in .js file/same qa pro script gives that
asked Jul 15, 2016 in QA Wizard Pro by Deepthi

1 Answer

0 votes

Example of how to use the function:
Window("WysiCorp  Report a Bug").InvokeJavaScript("JS Script Here / could also be a variable with JS In.")

Example 1:
'Perform click on button using jQuery that is already loaded on my web app
strJSScript = "$('#buttoneventcode').click();"
Window("WysiCorp  Report a Bug").InvokeJavaScript(strJSScript)

Example 2:  Both of these do the same thing, just different ways of doing it
'Option 1:
jsVal = Window("WysiCorp  Report a Bug").InvokeJavaScript("(function(){var x = []; x.push('hello'); return JSON.stringify(x);})();")

'Option 2:
jsVal = Window("WysiCorp  Report a Bug").InvokeJavaScript("var x = []; x.push('hello'); JSON.stringify(x);")

answered Jul 16, 2016 by nico (8,200 points)
248 questions
262 answers
106 comments
2,037 users