Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selenium error shows up when i use http::persistent - undefined method `map' for true:TrueClass #104

Closed
nils-e opened this issue Jun 4, 2019 · 3 comments

Comments

@nils-e
Copy link

nils-e commented Jun 4, 2019

I get this error that shows up whenever I use http::persistent. If i simply let capybara run the default http client or if i set the default http client, there is no error.

I'm not configuring persistent at all Selenium::WebDriver::Remote::Http::Persistent.new

gems i'm using

gem 'selenium-webdriver', '3.14.0'
gem 'net-http-persistent', '~> 3.0.1'
gem 'capybara', '3.7.1'
gem 'cucumber', '3.1.2'
undefined method `map' for true:TrueClass
      Did you mean?  tap (NoMethodError)
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/oss/bridge.rb:567:in `find_elements_by'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/search_context.rb:78:in `find_elements'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/selenium/driver.rb:76:in `find_css'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/base.rb:98:in `find_css'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/queries/selector_query.rb:137:in `find_nodes_by_selector_format'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/queries/selector_query.rb:102:in `block in resolve_for'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/base.rb:77:in `synchronize'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/queries/selector_query.rb:101:in `resolve_for'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:707:in `block in _verify_selector_result'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/base.rb:82:in `synchronize'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:706:in `_verify_selector_result'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:102:in `assert_selector'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:40:in `block in has_selector?'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:737:in `make_predicate'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:40:in `has_selector?'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/node/matchers.rb:270:in `has_css?'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/session.rb:728:in `block (2 levels) in <class:Session>'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/capybara-3.7.1/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
      /Users/nrognerud/gardian_rak/features/ss-ng2/step_definitions/ng2_steps.rb:217:in `block in <top (required)>'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `instance_exec'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `block in cucumber_instance_exec_in'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:54:in `cucumber_run_with_backtrace_filtering'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:27:in `cucumber_instance_exec_in'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/step_definition.rb:110:in `invoke'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/step_match.rb:31:in `invoke'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:79:in `invoke_dynamic_step'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/proto_world.rb:143:in `block (2 levels) in for'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/proto_world.rb:29:in `step'
      /Users/nrognerud/gardian_rak/features/ss-ng2/step_definitions/ng2_steps.rb:168:in `block in <top (required)>'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `instance_exec'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `block in cucumber_instance_exec_in'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:54:in `cucumber_run_with_backtrace_filtering'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:27:in `cucumber_instance_exec_in'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/glue/step_definition.rb:110:in `invoke'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/step_match.rb:31:in `invoke'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/step_match.rb:24:in `block in activate'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/action.rb:24:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/step.rb:32:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:104:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:51:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:27:in `test_step'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/step.rb:17:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:28:in `block (3 levels) in describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:27:in `each'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:27:in `block (2 levels) in describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/prepare_world.rb:22:in `block in test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/around_hook.rb:17:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:104:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:51:in `execute'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:34:in `around_hook'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/around_hook.rb:12:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:120:in `block (2 levels) in compose_around_hooks'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:121:in `compose_around_hooks'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:26:in `block in describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/runner.rb:19:in `test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/prepare_world.rb:11:in `test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:57:in `test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/retry.rb:18:in `test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/quit.rb:12:in `test_case'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:21:in `block in done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:20:in `map'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:20:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/filters/locations_filter.rb:20:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/filter.rb:62:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/compiler.rb:24:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core/gherkin/parser.rb:39:in `done'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core.rb:32:in `parse'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-core-3.2.0/lib/cucumber/core.rb:21:in `compile'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:75:in `run!'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/bin/cucumber:23:in `load'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/bin/cucumber:23:in `<main>'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:24:in `eval'
      /Users/nrognerud/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:24:in `<main>'
      features/ss-tracking/clickLink_tracking.feature:393:in `And I log into ng2'
@nils-e
Copy link
Author

nils-e commented Jun 4, 2019

I printed the current url and i get this back Current URL: true

the step right before it, gives me a correct url. Getting it from Selenium::WebDriver::Driver.current_url

@drbrain
Copy link
Owner

drbrain commented Apr 29, 2020

This appears to be a bug in selenium, I see SeleniumHQ/selenium#4555 referenced here a few lines above the last line of your backtrace.

Digging through more of selenium-webdriver it seems you can pick whether it uses net-http-persistent or not (see this search), but I'm not sure how that is performed.

Please ask the selenium people for support in this, perhaps they have some bug in their use of net-http-persistent?

@drbrain drbrain closed this as completed Apr 29, 2020
@thomas-schultz
Copy link

Still happens from time to time in my tests:

NoMethodError: undefined method `map' for 0:Integer
     /var/lib/gems/3.0.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/remote/bridge.rb:558:in `find_elements_by'
     /var/lib/gems/3.0.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/search_context.rb:78:in `find_elements'
     /var/lib/gems/3.0.0/gems/capybara-3.39.2/lib/capybara/selenium/extensions/find.rb:17:in `find_by'
     /var/lib/gems/3.0.0/gems/capybara-3.39.2/lib/capybara/selenium/extensions/find.rb:11:in `find_css'
     /var/lib/gems/3.0.0/gems/capybara-3.39.2/lib/capybara/node/base.rb:110:in `find_css'
     /var/lib/gems/3.0.0/gems/capybara-3.39.2/lib/capybara/queries/selector_query.rb:253:in `find_nodes_by_selector_format'
     /var/lib/gems/3.0.0/gems/capybara-3.39.2/lib/capybara/queries/selector_query.rb:166:in `block in resolve_for'

using

  • Ubuntu 22.04.3 LTS
  • ruby 3.0.2p107
  • selenium-webdriver (4.11.0)
  • capybara (3.39.2)
  • Mozilla Firefox 102.10.0esr (from debian)
  • geckodriver 0.33.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants