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

System.NullReferenceException on Element Find

7 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 14 Jan 2015, 08:17 PM
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. 

7 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 19 Jan 2015, 08:58 AM
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
 
0
Adam
Top achievements
Rank 1
answered on 19 Jan 2015, 08:41 PM
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. 
0
Boyan Boev
Telerik team
answered on 20 Jan 2015, 06:47 AM
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
 
0
gmendez
Top achievements
Rank 1
answered on 09 Jun 2015, 05:12 PM

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 

0
Boyan Boev
Telerik team
answered on 12 Jun 2015, 07:44 AM
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
 
0
gmendez
Top achievements
Rank 1
answered on 12 Jun 2015, 12:14 PM

Yes, off course.

Thanks!

0
Boyan Boev
Telerik team
answered on 12 Jun 2015, 01:19 PM
Hello Gonzalo,

Thank you!

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