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

NullReferenceException

1 Answer 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michal
Top achievements
Rank 1
Michal asked on 05 Oct 2016, 08:35 PM

I have a problem with finding an element. When I run my test, then sometimes I get this error in my test step and sometimes it works. I tried wait steps and other wait methods in code, but it doesn't help me.

ArtOfTest.Common.Design.Exceptions.ExecutionException: Exception thrown executing coded step: 'Check unit prices in the modal form'. ---> System.NullReferenceException: Object reference not set to an instance of an object.   at ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv..ctor(Element e)

Here is the code, where it crashes:

HtmlFind find = new HtmlFind(Manager.ActiveBrowser.Find.ById("modal"));
HtmlDiv div = new HtmlDiv(find.ByAttributes("class=col-info")); 

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 10 Oct 2016, 12:49 PM
Hello Michal,

Thank you for contacting us. 

Since the observed inconsistency is intermittent I assume the application is not in a state to find the elements. Have you tried to refresh the DOM tree? This could be obtained in code as follows:

Manager.ActiveBrowser.RefreshDomTree();

If this would not help you as well please consider sharing your exact script and access to your application so that I could continue the investigation. Thanks in advance for the cooperation! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Michal
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or