How to take element by javascript.

6 posts, 1 answers
  1. Anton
    Anton avatar
    54 posts
    Member since:
    Sep 2011

    Posted 29 Jan 2013 Link to this post

    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.
  2. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 29 Jan 2013 Link to this post

    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
  3. Anton
    Anton avatar
    54 posts
    Member since:
    Sep 2011

    Posted 30 Jan 2013 Link to this post

    Hello Boyan.

    Thanks for answer.

    I think that it will be great if WebAii can take element by invoked javascript.
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 30 Jan 2013 Link to this post

    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
  5. Anton
    Anton avatar
    54 posts
    Member since:
    Sep 2011

    Posted 31 Jan 2013 Link to this post

    As i understand, it is limitation of WebAii? Because this feature is implemented in WebDriver (Selenium 2).
  6. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 04 Feb 2013 Link to this post

    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
Back to Top