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

How to take element by javascript.

5 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 29 Jan 2013, 03:45 PM
Hello,

Is it possible?
I try to use 
Actions.InvokeScript<HtmlSpan>(
                "$j('#rulesTree span.rf-trn-lbl')" +
                ".filter(function() " +
                "{return $j(this).text().trim() == 'er';})").Click();

But take exception:
            • Object reference not set to an instance of an object.

5 Answers, 1 is accepted

Sort by
0
Accepted
Boyan Boev
Telerik team
answered on 29 Jan 2013, 05:04 PM
Hello Anton,

Unfortunately you can't do it in this direct way. InvokeScript is invoking functions.

Please implement your code in a function in the html application and call the Click() event in there.

Then call the functions using InvokeScript:

Actions.InvokeScript("myFunction()");

I recorded a short video as a demonstration.

Hope this helps.
Kind regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 30 Jan 2013, 08:25 AM
Hello Boyan.

Thanks for answer.

I think that it will be great if WebAii can take element by invoked javascript.
0
Boyan Boev
Telerik team
answered on 30 Jan 2013, 03:58 PM
Hi Anton,

Unfortunately the types that can be returned are strictly typed and can only be basic C# types, bool, int, string, etc. 

Should you have any additional questions please do not hesitate to contact us again.

Regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 31 Jan 2013, 09:12 AM
As i understand, it is limitation of WebAii? Because this feature is implemented in WebDriver (Selenium 2).
0
Boyan Boev
Telerik team
answered on 04 Feb 2013, 12:16 PM
Hello Anton,

Yes, this is a limitation of WebAii unfortunately.

I have created a feature request, which you can follow in our public portal.

As thanks for your feature request, I have added  Telerik Points to your Telerik.com account.

Thank you for your input, which we rely upon to improve our product. 

Regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Anton
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Anton
Top achievements
Rank 1
Share this question
or