GithubHelp home page GithubHelp logo

s4na / capybara-playwright-driver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yusukeiwaki/capybara-playwright-driver

0.0 0.0 0.0 169 KB

Playwright driver for Capybara

License: MIT License

Shell 0.17% Ruby 99.83%

capybara-playwright-driver's Introduction

Gem Version

🎭 Playwright driver for Capybara

Make it easy to introduce Playwright into your Rails application.

gem 'capybara-playwright-driver'

NOTE: If you want to use Playwright-native features (such as auto-waiting, various type of locators, ...), consider using playwright-ruby-client directly.

Examples

require 'capybara-playwright-driver'

# setup
Capybara.register_driver(:playwright) do |app|
  Capybara::Playwright::Driver.new(app, browser_type: :firefox, headless: false)
end
Capybara.default_max_wait_time = 15
Capybara.default_driver = :playwright
Capybara.save_path = 'tmp/capybara'

# run
Capybara.app_host = 'https://github.com'
visit '/'
first('div.search-input-container').click
fill_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"]').click
page.driver.with_playwright_page do |page|
  page.get_by_label('Capybara, Search all of GitHub').click
end

all('[data-testid="results-list"] h3').each do |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.

capybara-playwright-driver's People

Contributors

yusukeiwaki avatar yuki24 avatar sinsoku avatar jean-francois-labbe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.