This is a migrated thread and some comments may be shown as answers.

In FF4 Actions.InvokeScript is broken for arrays

11 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alexey Ivanov
Top achievements
Rank 1
Alexey Ivanov asked on 31 May 2011, 09:42 AM
Hello

to reproduce use this code:
var actions = Manager.Current.ActiveBrowser.Actions;
actions.InvokeScript("window.my_list=[1,2,3]");
var list = actions.InvokeScript<IList>("window.my_list"); // here

In IE and FF3: object[3] { 1, 2, 3}
In FF4: empty array object[0]

Fix please

11 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 08 Jun 2011, 03:12 AM
Hi Alexey Ivanov,

       could you please also provide the javascript against which we can reproduce this issue. Please create a small sample page with the javascript code and we'll analyze the problem.

Greetings,
Stoich
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Ivanov
Top achievements
Rank 1
answered on 08 Jun 2011, 09:35 AM
Stoich, you can use code that I shown in my prev message with any html page.
As you can see, it first creates an array and then reads it back.
0
Stoich
Telerik team
answered on 15 Jun 2011, 09:10 AM
Hello Alexey,
    I've logged this as a bug and you can track its progress here:
http://www.telerik.com/support/pits.aspx#/public/test-studio/6501
My guess is that this issue is related to the way FF4 interprets Javascript code and it's not related to our product at all. However, our developers will have to determine whether this is really the case.

Kind regards,
Stoich
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Ivanov
Top achievements
Rank 1
answered on 15 Jun 2011, 10:02 AM
Thanks Stoich.
I think your developers will be able to find a way around this :)
0
Stoich
Telerik team
answered on 06 Jul 2011, 04:43 PM
Hi Alexey,
      would you please describe your use case. We're currently discussing the issue with our developers. We would like to learn a bit more about the functionality you're trying to achieve. We might be able to assist you in finding an alternative way to handle your automation task.

Regards,
Stoich
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Alexey Ivanov
Top achievements
Rank 1
answered on 07 Jul 2011, 01:59 PM
My use case:
On the page I have a javascript function which returns an array. I check items of this array.
I understand that I might join items with separators and check the string.
But why not to make the script API uniform on your side? Moreover it worked earlier.
0
Stoich
Telerik team
answered on 13 Jul 2011, 12:53 PM
Hello Alexey,
  the issue is probably related to a change in FF4+’s Javascript handling.

Firefox seems to be treating the list as a map, and returning a JSON-encoded version of it. You can probably work around it by not casting the result to IList and handling the JSON value yourself.

Greetings,
Stoich
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Alexey Ivanov
Top achievements
Rank 1
answered on 13 Jul 2011, 12:58 PM
Regarding "can probably work around":
would you please show me a simple example?

InvokeScript returns an array. I cannot figure out how to treat it as JSON and parse manually.
0
Cody
Telerik team
answered on 18 Jul 2011, 07:44 PM
Hi Alexey Ivanov,

It took a little research but here's how to get at the array and it's contents/values:

var actions = Manager.Current.ActiveBrowser.Actions;
JsonObject result = actions.InvokeScript <JsonObject>("window.my_list=[1,2,3]");
JsonArray arr = (JsonArray)result["root"];
for (int i = 0; i < 3; i++)
{
    double val = arr[i];
    Log.WriteLine(val.ToString());
}

Regards,
Cody
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Alexey Ivanov
Top achievements
Rank 1
answered on 20 Jul 2011, 03:37 PM
Thank you Cody for this information.
Is there anything preventing you from including this to the WebAii library code?
It would make the InvokeScript API consistent among browsers.

0
Cody
Telerik team
answered on 20 Jul 2011, 05:42 PM
Hello Alexey Ivanov,

We will add it to this page of our online documentation.

Kind regards,
Cody
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
Tags
General Discussions
Asked by
Alexey Ivanov
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Alexey Ivanov
Top achievements
Rank 1
Cody
Telerik team
Share this question
or