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.
Related cards:
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...
Resolving Element cannot be scrolled into view (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError) on Mavericks
After I upgraded to Mac OS X Mavericks, I regularly got this error message when running Cucumber features with Selenium:
Element cannot be scrolled into view:[object XrayWrapper [object HTMLInputElement]] (Selenium::WebDriver::Error::MoveTarg...
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::Op...
Cucumber step to interact with an iframe using Capybara webdriver
Give your iframe
a name attribute (i.e. <iframe name="myframe">
) and then simply use
When I press "Foo" in the iframe "myframe"
Then I should see "Bar!" in the iframe "myframe"
Step as follows:
Then /^(.*) in the iframe "([^\"...
Popular mistakes when using nested forms
Here are some popular mistakes when using nested forms:
- You are using
fields_for
instead ofform.fields_for
. - You forgot to use
accepts_nested_attributes
in the containing model. Rails won't complain, but nothing will work. In particular...
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.
...
How to clear cookies in Capybara tests (both Selenium and Rack::Test)
Capybara drivers will usually delete all cookies after each scenario. If you need to lose cookie data in the middle of a scenario, you can do this:
browser = Capybara.current_session.driver.browser
if browser.respond_to?(:clear_cookies)
...
Async control flow in JavaScript: Promises, Microtasks, async/await
Slides for Henning's talk on Sep 21st 2017.
Understanding sync vs. async control flow
Talking to synchronous (or "blocking") API
print('script start')
html = get('/foo')
print(html)
print('script end'...
How to fix routing error when using concerns in Rails up to 3.2.22.1
tl;dr
-
Don't write
resources :people, :concerns => :trashable
-
Write
resources :people do concerns :trashable end
Why
Writing a controller spec I encountered this error:
Failure/Error: get :index
ActionControl...
Beware when using ActiveSupport time and date calculation methods
The pitfall
Rails Active Support provides some helpful methods for calculating times and dates, like Duration#ago
or [Duration#from_now
](https://api.rubyonrail...