Forum Discussion

lodecesa's avatar
lodecesa
Contributor
2 years ago

ClickItem for a Dropdown select object partially out of screen (in bottom of the page) don't work

I have implemented a Keyword Test in TestComplete that insert some data in a web form. When i try to select an option of a dropdown object (<select> tag) with an On-screen Action "ClickItem" it don't work if the <select> object is on the bottom of the page and it's partially out of the screen (is visible only the upper half). When the test arrives to this action is performed a little scroll of the page to visualize the <select> interely and the options appears but  test complete show the status string "waiting until the dropdown box appears" and then the test continues without having selected the option desired. I have solved inserting before the On-screen Action ClickItem the On-screen Action DropDown. Because there are so many <select> to set I would like to avoid this solution.

The questions are: this is a known issue? There is an easier method to fix it?

 

Thanks!

  • Kitt's avatar
    Kitt
    Regular Contributor

    Try using element.scrollIntoView() - see post [here].

    • lodecesa's avatar
      lodecesa
      Contributor

      Kitt wrote:

      Try using element.scrollIntoView() - see post [here].

       

      If you read well my solution also works but it has the problem of the double action that has to be repeated for each <select> and I have several of them in my <form>

      • lodecesa's avatar
        lodecesa
        Contributor

        lodecesa wrote:

        Kitt wrote:

        Try using element.scrollIntoView() - see post [here].

         

        If you read well my solution also works but it has the problem of the double action that has to be repeated for each <select> and I have several of them in my <form>


        I'm here to correct me, the solution I adopted to remedy the problem is not fully functional. I was forced to use ScrollIntoView instead of DropDown. The fact remains that it is unacceptable to have to use two commands to overcome the inconvenience that occurs when a <select> is partially off the screen.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    The questions are: this is a known issue?

    I don't think this is an issue but rather correct expected behavior.

    It is my guess that your code just executes .ClickItem() action. If my guess is correct, then, without parameters been provided, .ClickItem() tries to click in the middle of the element. The click cannot be done because middle of the element is out of viewport.

     

    It is quite OK to call .scrollIntoView(true/false) before any click. Or you may just try .ClickItem(1, 1).

     

    Hope that my guess is correct and explains the observed behavior.

     

     

    • lodecesa's avatar
      lodecesa
      Contributor

      AlexKaras wrote:

      Hi,

       

      The questions are: this is a known issue?

      I don't think this is an issue but rather correct expected behavior.

      It is my guess that your code just executes .ClickItem() action. If my guess is correct, then, without parameters been provided, .ClickItem() tries to click in the middle of the element. The click cannot be done because middle of the element is out of viewport.

       

      It is quite OK to call .scrollIntoView(true/false) before any click. Or you may just try .ClickItem(1, 1).

       

      Hope that my guess is correct and explains the observed behavior.

       

       


      In fact, the <select> is in a position where ClickItem can make the DropDown with the available <options> appear, so I do not think that is the problem. After ClickItem, the DropDown appears but TestComplete says it does not see it. It does not seem like a correct behavior but rather an anomaly