NullReferenceException

2 posts, 0 answers
  1. Michal
    Michal avatar
    1 posts
    Member since:
    Sep 2016

    Posted 05 Oct Link to this post

    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")); 

  2. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    251 posts

    Posted 10 Oct Link to this post

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