Is it possible to interact with hidden elements with capybara?

前端 未结 7 927
孤街浪徒
孤街浪徒 2021-02-06 21:08

I have a file field that has opacity: 0 and is overlaping a fake button. Its a common css technic to fake a sort of \"Upload button\" that displays consistently acr

7条回答
  •  [愿得一人]
    2021-02-06 21:45

    The author of Capybara recommends setting Capybara.ignore_hidden_elements immediately prior to needing to see the invisible element, and resetting it afterwards:

    Capybara.ignore_hidden_elements = false
    click_button 'my invisible button'
    Capybara.ignore_hidden_elements = true
    

提交回复
热议问题