Note: As only the box tree is affected, any semantics based on the document tree, such as selector-matching, event handling, and property inheritance, are not affected. As of writing, however, this is not implemented correctly in major browsers, so using this feature on the Web must be done with care as it can prevent accessibility tools from accessing the element’s semantics.
page.driver.browser.action.context_click(find('video').native).perform
does indeed open it but I can't seem to be able to work with it (via page.driver.browser.action.send_keys(:arrow_down).perform
) or capture it in a screenshot. Any ideas?
driver.needs_server?
so capybara doesn't try to start one up? For context we use rspec / puma / selenium / firefox, but I don't think that would matter too much.
context 'cannot connect to redis' do
before { simulate_failed_connection }
it { logs_failed_connection }
it { is_expected.to be false }
end
```
Failure/Error: visit("/channels/cf_internal/jobs/#{job.id}/editor_preview")
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
TypeError: undefined is not a function (evaluating 'window.addEvent')
TypeError: undefined is not a function (evaluating 'window.addEvent')
at http://127.0.0.1:35487/channels/cf_internal/jobs/64/editor_preview:28 in global code
# /usr/local/bundle/gems/poltergeist-1.17.0/lib/capybara/poltergeist/browser.rb:384:in `command'
# /usr/local/bundle/gems/poltergeist-1.17.0/lib/capybara/poltergeist/browser.rb:39:in `visit'
# /usr/local/bundle/gems/poltergeist-1.17.0/lib/capybara/poltergeist/driver.rb:99:in `visit'
# /usr/local/bundle/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
# /usr/local/bundle/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/features/cml/multiple_spec.rb:20:in `block (2 levels) in <top (required)>'
window
object is not available
window.addEvent
isn't defined - likely due to using JS in your assets that isn't support by Poltergeist which then prevents other JS from being executed when all your assets are combined into one by the asset pipeline. The real solution is to stop using poltergeist - it was obsolete 3 years ago - time to move to a newer driver
driver = Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
click_on(exact_text: /\w{48}\.txt/)
. Before that I do a "search" in my app which returns one result (the one that must be clicked). But Capybara tells me Ambiguous match, found 38 elements matching visible link or button nil
. This is definitely not correct. There is only one link that has that exact text. If I get the HTML that is produced by the failure and put it in a simple test case, it passes. Capybara does something strange. If I change it to click_on(text: /\w{48}\.txt/)
it works fine. This is using Capybara.exact = false
. Any ideas?
sleep 1
before that, it passes too.
default_max_wait_time
set to a very small value? Workarounds could possibly be click_on(text: /^\w{48}\.txt$/)
or click_on(text: /\w{48}\.txt/, exact_text: true)
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/bridge.rb:57:in `create_session'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/driver.rb:340:in `create_bridge'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/driver.rb:74:in `initialize'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/driver.rb:47:in `new'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/driver.rb:47:in `for'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver.rb:88:in `for'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/capybara-3.36.0/lib/capybara/selenium/driver.rb:83:in `browser'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/capybara-3.36.0/lib/capybara/selenium/driver.rb:104:in `visit'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/capybara-3.36.0/lib/capybara/session.rb:278:in `visit'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/capybara-3.36.0/lib/capybara/dsl.rb:53:in `call'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/capybara-3.36.0/lib/capybara/dsl.rb:53:in `visit'
/home/derrell/RubymineProjects/AliasMadness/features/step_definitions/login.step_definition.rb:22:in `nil'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-7.1.0/lib/cucumber/glue/invoke_in_world.rb:26:in `cucumber_instance_exec_in'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-7.1.0/lib/cucumber/glue/step_definition.rb:133:in `invoke'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-7.1.0/lib/cucumber/step_match.rb:33:in `invoke'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-7.1.0/lib/cucumber/step_match.rb:26:in `block in activate'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/action.rb:23:in `execute'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/step.rb:35:in `execute'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/runner.rb:106:in `execute'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/runner.rb:53:in `execute'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/runner.rb:29:in `test_step'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/step.rb:23:in `describe_to'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/case.rb:31:in `block (3 levels) in describe_to'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/case.rb:30:in `each'
/home/derrell/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/cucumber-core-10.1.1/lib/cucumber/core/test/case.rb:30:in `block (2 levels) in describe_to'
That's my stack trace. I have numerous errors, and they all start with a Capybara#visit
call. I suspect they're the first such call in each flow (it will take some time to check that, if it's relevant). I have just upgraded gems for ruby 2.7.5 from 2.6.?. Upgrading ruby and just doing bundle install
wasn't enough to trigger this error, but in attempting to push to heroku, I kept having issues with the asset pipeline, and had to upgrade mini_racer, and thus all of the stuff in the test gems to be sure it was working as it would. Now my tests fail, and I am hoping it's just webdriver and not something deep in my code.
This is Rails 6 latest.