(WebAutomation) How to pass a Value to javascript?

WebAutomation.LaunchChrome Url:‘https://www.amazon.in/gp/goldbox?ref=nav_topnav_deals’ WindowState:WebAutomation.BrowserWindowState.Maximized ClearCache:False ClearCookies:False BrowserInstance=> Browser
wait 2
loop i from 1 to 25 step 1
WebAutomation.ExecuteJavascript BrowserInstance:Browser Javascript:’’‘function ExecuteScript(’’‘i ‘’’) {
var name = document.getElementsByClassName(“a-size-base a-link-normal dealTitleTwoLine singleCellTitle autoHeight”)[i].innerText;
var price= document.getElementsByClassName(“a-size-medium inlineBlock unitLineHeight dealPriceText”)[].innerText;
var z1=[name,price ];
return(z1);}’’’ Result=> Result
set i to i+1
Console.Write Message: Result

I am just adding a screenshot with the script modified according to the best standards we follow (line separation, indentation etc) :

Result output argument should represent the returning value from your javascript code.
Have you debugged your javascript code?

Best regards,

1 Like