thoughtbot / capybara-webkit

A Capybara driver for headless WebKit to test JavaScript web apps
https://thoughtbot.com/open-source
MIT License
1.97k stars 427 forks source link

Possible to silence "Attempt to select disabled option"? #941

Closed gkop closed 8 years ago

gkop commented 8 years ago

In the course of my tests, I am asserting that a disabled option cannot be selected, by using capybara's choose method on the option. Is there a way to accomplish this without triggering the warning in the console "Attempt to select disabled option"?

(On v1.11.1, testing against qt 4.8.1 and 5.3.2)

twalpole commented 8 years ago

This message comes from Capybara not capybara-webkit, and there's no way to disable it if you're calling choose. Rather than try and choose it you could just verify the option is disabled with something like

expect(page).to have_selector(:option, 'The option', disabled: true)
gkop commented 8 years ago

That sounds good, thanks for the quick reply!