Selenium WebDriver 2.5.0, 2.6.0 fails when selecting options from select boxes
We are consistently having trouble with selenium-webdriver > 2.5.0
where whenever we try to select an option from a <select>
Capybara complains:
No such option 'Foo' in this select box. Available options: 'Foo', 'Bar', 'Baz' (Capybara::OptionNotFound)
This seems to happen with both old and new versions of Firefox. Our workaround so far is to freeze the gem at version 0.2.2
.
Related cards:
Hack-fix Selenium::WebDriver::Element#select is deprecated
In some older Capybara versions (e.g. 0.3.9), we're getting lots of deprecations warnings:
Selenium::WebDriver::Element#select is deprecated. Please use Selenium::WebDriver::Element#click and determine the current state with Selenium::WebDriv...
Take care when joining and selecting on scopes
Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.
Many times you would use scope options, like this:
users = User.scoped(
:joins => 'INNER JOIN orders joined_...
Selector for finding the currently selected option in a <select> tag
Use option:checked
to find the currently selected option:
select.querySelector('option:checked')
Yes, :checked
, not :selected
.
This is the same as finding an option with the { selected: true }
property in JavaScript:
sele...
How to configure Selenium WebDriver to not automatically close alerts or other browser dialogs
tl;dr
We recommend configuring Selenium's unhandled prompt behavior to "ignore".
When running tests in a real browser, we use Selenium. Each browser is controlled by a specific driver, e.g. Selenium::WebDriver::Chrome
for Chrome.
...
Error "execution expired (Timeout::Error)" when using Selenium and Webmock
If you get the above error when running tests in bulk (but not individually), it's actually the fault of Webmock.
Updating Webmock to version 1.7+ fixes this.
Bug in Chrome 56+ prevents filling in fields with slashes using selenium-webdriver/Capybara
There seems to be a nasty bug in Chrome 56 when testing with Selenium and Capybara: Slashes are not written to input fields with fill_in
. A workaround is to use javascript / jquery to change the contents of an input field.
Use the following cod...
How to solve Selenium focus issues
Selenium cannot reliably control a browser when its window is not in focus, or when you accidentally interact with the browser frame. This will result in flickering tests, which are "randomly" red and green. In fact, this behavior is not random at...
Unobtrusive jQuery to toggle visibility with selects and checkboxes
Use this if you want to show or hide part of a form if certain options are selected or boxes are checked.
The triggering input gets an data-selects-visibility
attribute with a selector for the elements to show or hide, like
<%= form.select...
Cronjobs: "Craken" is dead, long live "Whenever"
Our old solution for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+.
We will instead use the whenever gem.
"Whenever" works just like "craken", by putting your rake ta...
Test that a select option is selected with Cucumber
This step tests whether a given select option comes preselected in the HTML. There is another step to test that an option is available at all.
Cap...