How I can avoid “Element is not currently visible and so may not be interacted with ” Selenium Webdriver

前端 未结 11 1154
死守一世寂寞
死守一世寂寞 2020-12-16 14:02

Am using selenium webdriver 2.210 + JAVA for testing.I have a sample code for selecting all mails in gmail.But the code throws an \"Element is not currently visible and so m

11条回答
  •  猫巷女王i
    2020-12-16 14:52

    Selenium will not interact with WebElements that are hidden or that are not displayed to the user. In this case, it's not unusual for user clicks to interact with a div element or something similar which in turn triggers the actual button, which is hidden for visual purposes. I'd suggest running through the steps in the selenium IDE in firefox on your page. See if multiple events are triggered when you perform the click on your "hidden" element. In the case that multiple events are in fact triggered, follow suit in your WebDriver code.

提交回复
热议问题