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

Example code does not work #3

Open
aemadrid opened this issue Jun 5, 2024 · 0 comments
Open

Example code does not work #3

aemadrid opened this issue Jun 5, 2024 · 0 comments

Comments

@aemadrid
Copy link

aemadrid commented Jun 5, 2024

When I try the example code from Basic Usage I get an error:

# web_driver_test.rb
require 'async/webdriver'

Async do
  bridge = Async::WebDriver::Bridge::Safari.start
  client = Async::WebDriver::Client.open(bridge.endpoint)

  session = client.session(bridge.default_capabilities)
  # Set the implicit wait timeout to 10 seconds since we are dealing with the real internet (which can be slow):
  session.implicit_wait_timeout = 10_000

  session.visit('https://google.com')

  session.fill_in('q', 'async-webdriver')
  session.click_button("I'm Feeling Lucky")

  puts session.document_title
ensure
  session&.close
  client&.close
  bridge&.close
end

Console output:

❯ ruby web_driver_test.rb
 0.02s     warn: Async::Task [oid=0x244] [ec=0x258] [pid=83585] [2024-06-05 13:09:08 -0600]
               | Task may have ended with unhandled exception.
               |   NoMethodError: undefined method `default_capabilities' for an instance of Async::WebDriver::Bridge::Chrome::Driver (NoMethodError)
               |
               |     session = client.session(bridge.default_capabilities)
               |                                    ^^^^^^^^^^^^^^^^^^^^^
               |   → web_driver_test.rb:7 in `block in <main>'
               |     /Users/some_user/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/async-2.12.0/lib/async/task.rb:164 in `block in run'
               |     /Users/some_user/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/async-2.12.0/lib/async/task.rb:377 in `block in schedule'
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

1 participant