System.NullReferenceException on Element Find

8 posts, 0 answers
  1. Adam
    Adam avatar
    6 posts
    Member since:
    Jan 2015

    Posted 14 Jan 2015 Link to this post

    I'm getting a System.NullReferenceException on the following: 

    HtmlSpan policySpan = kendoIE.ActiveBrowser.Find.ByContent<HtmlSpan>("p:foo"); 

    And I know the span is there, 

    I've tried xpath, which is this : //html/body/div[2]/div/div/div[1]/div/ul/li[3]/ul/li[1]/span

    and I still get the same exception. 

    Thanks, 

    Adam. 
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 19 Jan 2015 Link to this post

    Hello Adam,

    What is "kendoIE"? If this is some parent element and you want to find the span withing this element you should use: 

    HtmlSpan policySpan = kendoIE.Find.ByContent<HtmlSpan>("p:foo");

    otherwise your code should look lie:

    HtmlSpan policySpan = ActiveBrowser.Find.ByContent<HtmlSpan>("p:foo");

    If the issue persists please send a screen shot of the DOM so we can assist you with the find expression.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Adam
    Adam avatar
    6 posts
    Member since:
    Jan 2015

    Posted 19 Jan 2015 in reply to Boyan Boev Link to this post

    the kendoIE was the manager reference, however I was able to find the element using a different reference :-) It just took some digging deeper. 

    Thanks, 

    Adam. 
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 20 Jan 2015 Link to this post

    Hello Adam,

    Glad to hear that.

    If you need further assistance please let us know.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  5. gmendez
    gmendez avatar
    82 posts
    Member since:
    Jun 2012

    Posted 09 Jun 2015 in reply to Adam Link to this post

    Hi Adam

     I have a very similar issue, bu in my case with Find.ById<TControl>() as described here: 

    http://www.telerik.com/forums/unable-to-find-html-elements

    What's very strange is that running my code against a website hosted in my local computer works, while testing on a remote testing machine over internet, doesn't. 

    I made sure that all the security requisites for runing tests on IE were correctly set. Both sites run using https. I can't find a difference...

    Could you tell my how you resolved your problem?

    Thanks,

     Gonzalo

     

    Could you 

  6. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 12 Jun 2015 Link to this post

    Hello Gonzalo,

    Let's please continue the discussion in the other forum thread where my colleague Ivaylo is investigating the issue. 

    Thank you.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  7. gmendez
    gmendez avatar
    82 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2015 in reply to Boyan Boev Link to this post

    Yes, off course.

    Thanks!

  8. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 12 Jun 2015 Link to this post

    Hello Gonzalo,

    Thank you!

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top