Element Not Found.

4 posts, 0 answers
  1. abhishek
    abhishek avatar
    1 posts
    Member since:
    Jul 2016

    Posted 03 Oct 2016 Link to this post

    Hi All

    I am using Telerik Test Studio for Automation Testing . I am facing issue related to "Element no found" .

    I have added element ("Gateway Name") in the DOM and object that needs to be identified is available in one of the Cell, after rebuild project .. I run my test cases and I am getting an error "element not found".

    Is there any other way to store element permanently in the DOM because I have added "Gateway Name" element so many times in the DOM.

    Please provide the solution for identifying these dynamic objects

    Regards

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1072 posts

    Posted 06 Oct 2016 Link to this post

    Hello Abhi,

    Let me explain how Test Studio locates an element. Test Studio uses an intelligent element identification scheme to auto-generate find expressions. When an element is ready to be added to the Elements Explorer, Test Studio tries to use the first item in the list (usually "id"). Using this criteria, if the item is unique for the entire page, the element is added, a find expression is created, and Test Studio stops evaluating.

    However if some of the attributes in the find expression is dynamically generated and constantly changes with every reloading of the page Test Studio cannot find it anymore. When you record the element again Test Studio will add a new element because it has changed find criteria already. 

    In order to overcome this change how the element is found. You should create a find expression only with static find rules (e.g. TextContent, ID e.t.c.).

    Let me know if that helps. 

    Regards,
    Boyan Boev
    Telerik by Progress
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. inchis
    inchis avatar
    1 posts
    Member since:
    Aug 2018

    Posted 03 Sep 2018 in reply to Boyan Boev Link to this post

    Hello,

    I have to  code the way to find the list values for a list view as I am not relying the exact id for finding the element.

    In my case ,

    I tried regular expression to detect the element which is a trigger picker of a combo list. After clicking this , I have to find the list which is populated somewhere down in the dom tree. To identify this , I tried the following code.

                 1. HtmlDiv assignee  =Pages.Https1013129.AssigntoInnerCtDiv.Find.ByExpression<HtmlDiv>("id=~trigger-picker");
                 2. Console.WriteLine(assignee.ID);
                 3. Thread.Sleep(10000);
                 4. assignee.MouseClick(); 
                 5. Thread.Sleep(10000);
                 6. char[] hyphenSeparator = new char[] { '-' };
                 7. String id =assignee.ID.Split(hyphenSeparator)[1];
                 8. Console.WriteLine("Id" +id);
                 9. string searchID= "id=combo-"+id+"-picker";
                10. Console.WriteLine("searchID--" +searchID);
                11.  Element  listElement =Manager.ActiveBrowser.Find.ByExpression(searchID);

                 12.Console.WriteLine("listElement"+listElement);

             

     

    Upon running the test , the click of the list arrow was done successfully and it printed the id value as 2215 in the console for line 8.

    It also printed the value id=combo-2215-picker for line 10.

    However the listElement is printed as empty , though it is available in the domtree(please find the attachment).

     

    Please let me know what is missing from my end .

     

  4. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    1048 posts

    Posted 05 Sep 2018 Link to this post

    Hi Inchis,

    Thank you for the detailed description of the faced issue. 

    Please find some additional notes how you could construct a find expression in code and how to use the Find.ByExpression() method after that. I hope this will be helpful for you. Though in case you need any further assistance please let me know! 

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