You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require'capybara-playwright-driver'# setupCapybara.register_driver(:playwright)do |app|
Capybara::Playwright::Driver.new(app,browser_type: :firefox,headless: false)endCapybara.default_max_wait_time=15Capybara.default_driver=:playwrightCapybara.save_path='tmp/capybara'# runCapybara.app_host='https://github.com'visit'/'first('div.search-input-container').clickfill_in('query-builder-test',with: 'Capybara')## [REMARK] We can use Playwright-native selector and action, instead of Capybara DSL.# first('[aria-label="Capybara, Search all of GitHub"]').clickpage.driver.with_playwright_pagedo |page|
page.get_by_label('Capybara, Search all of GitHub').clickendall('[data-testid="results-list"] h3').eachdo |li|
#puts "#{li.all('a').first.text} by Capybara"puts"#{li.with_playwright_element_handle{ |handle| handle.text_content}} by Playwright"end
Refer the documentation for more detailed configuration.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Capybara::Playwright project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.