ExecuteScript("script") Help

Class library usage, coding and language questions.
Machisperer
Posts: 7
Joined: Wed May 02, 2018 3:48 pm

ExecuteScript("script") Help

Post by Machisperer » Thu Sep 06, 2018 5:50 pm

My webpage contains a table that I need to to read from only after it finishes loading. When using the browser's console (F12), I can run the following code command to get the state of the table:
customersGrid.InCallBack();
this returns true/false depending on whether the table has finished loading. customersGrid is an ASPxClientGridView

But I always get 'Undefined' when executing the same command in Ranorex using the following:
Report.Log(ReportLevel.Info, customersTable.OwnerDocument.ExecuteScript("customersGrid.InCallBack()"));

Any tips on the ExecuteScript("...") usage in this specific case would be much appreciated.

dpFourOFour
Certified Professional
Certified Professional
Posts: 38
Joined: Mon Dec 12, 2016 9:24 am

Re: ExecuteScript("script") Help

Post by dpFourOFour » Fri Sep 07, 2018 12:52 pm

Hi Machisperer,

Have you already tried adding a return to the executScript call?
repo.IndexHtml.Self.ExecuteScript("return METHOD()");
This should work as expected.

Best,
DP
Please always include the following information to your posts
  • Ranorex Version
  • OS Version

Machisperer
Posts: 7
Joined: Wed May 02, 2018 3:48 pm

Re: ExecuteScript("script") Help

Post by Machisperer » Fri Sep 07, 2018 4:39 pm

Yes, I tried that but it always comes back as undefined.

Machisperer
Posts: 7
Joined: Wed May 02, 2018 3:48 pm

Re: ExecuteScript("script") Help

Post by Machisperer » Fri Sep 07, 2018 10:22 pm

I finally figured out my silly mistake: I was using uppercase 'B' in the InCallback() method. The console was auto-correcting this; that's why it was working in the console and not in my code.

Thanks again!