Selenium WebDriver clicking on hidden element

前端 未结 3 1400
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 00:53

Hi I would like to know how to click on hidden element and/or disable element by using Selenium WebDriver.

I know with selenium 1 I can do this as below:

         


        
3条回答
  •  既然无缘
    2020-12-16 01:22

    It may not fit your needs, but another solution for some might be to alter the CSS for hiding an element.

    Whilst Selenium won't find an element with display: none; it will find an element with the following:

    .hide {
        position: absolute;
        top: -99em;
        left: -99em;
    }
    

    Then rather than using jQuery.show/hide/toggle in your app, you would use jQuery.toggleClass('hide', true/false/unset_to_toggle).

提交回复
热议问题