Forum Discussion

sunireddy2007's avatar
sunireddy2007
Occasional Contributor
11 years ago

Dynamically updated DIV list

Hi All,



I have a webpage with main portion of the screen occupied by a DIV element with horizontal rows of DIV sections inside it. Each DIV section contains a heading and some text in various DIV elements. When the page contains more than 25 DIV sections, there is a Show More button which adds 25 more DIV sections upon its click and also a scrollbar to the right of the outer DIV container. I am able to seach for the DIV section I am interested in for the test when the page contains less than 25 DIV sections or the one I am looking/searching for is in the first 25 sections. But when I have to click the "Show More" button, even if the section I am looking for is added to the bottom of the page (outside of the view), the same script is not able to find the DIV section. 



My search logic is simple. I look for all DIV elements with a certain className and I always get only 25 elements back in the call to FinadAllChildren on the Page object. It means the FindAllChildren is not able to fetch the 25 more DIV elements that are added by clicking "Show More" button.



Can anyone help?



-Sunitha.
  • Try to do a
    Sys.Browser("nameOfYourBrowser").Refresh()
    before calling the FindAllChildren after clicking the show more.



    If this does not work, using the object spy, make sure the properties you are looking for (className) remain the same after clicking the show more.
  • jose_pita's avatar
    jose_pita
    Super Contributor
    Try to do a
    Sys.Browser("nameOfYourBrowser").Refresh()
    before calling the FindAllChildren after clicking the show more.



    If this does not work, using the object spy, make sure the properties you are looking for (className) remain the same after clicking the show more.
  • sunireddy2007's avatar
    sunireddy2007
    Occasional Contributor
    Thank you very much Jose. That worked. 



    I have another similar problem and this same solution is not working there. Here is the issue. There is a link on the page and upon clicking, it open a small floating DIV which stays for few seconds and disaapears. This DIV contains a hyper link and some text. I need to click that link to get into the flow. But I am not able to get hold of that floating DIV. I tried the above solution but it is not working in this particular case.



    -Sunitha.
  • jose_pita's avatar
    jose_pita
    Super Contributor
    If the link disappears you need to do :



    Sys.Browser("nameOfYourBrowser").Find("NameOfThePropertyOfTheObject", "ValueOfThePropertyOfTheObject", 30).Click();





    while the link is available.

    For example:





    Sys.Browser("firefox").Find(new Array("ObjectType", "VisibleOnScreen"), new Array("ValueOfThePropertyOfTheObject", "True"), 30).Click();





    If this does not work, look for the new div and use Find after the div instead of after the browser