GithubHelp home page GithubHelp logo

jeffnyman / webdriver_manager Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 33 KB

Provides a method of automatically downloading WebDriver binaries.

License: MIT License

Ruby 99.32% Shell 0.68%
webdriver selenium-webdriver watir

webdriver_manager's Introduction

WebDriver Manager

Gem Version License

Dependency Status

The goal of WebDriver Manager is to allow automated testing solutions an ability to have WebDriver binary drivers downloaded automatically.

Installation

Add this line to your application's Gemfile:

gem 'webdriver_manager'

And then include it in your bundle:

$ bundle

You can also install WebDriver Manager just as you would any other gem:

$ gem install webdriver_manager

Usage

Basic Usage

Here is an example script:

require "webdriver_manager"
require "watir"

browser = Watir::Browser.new :firefox

browser.quit()

All you have to do is include webdriver_manager. Once it's included, the gem provides hooks into the operation of Selenium WebDriver. When Watir, in this case, is used to instantiate a new Firefox browser, this gem kicks in and makes sure that geckodriver (or geckodriver.exe on Windows) is available. If the driver binary is not available, it will be downloaded for you.

All driver binaries are placed in a .webdrivers directory within the relevant directory referred to by the HOME environment variable for your operating system.

Browser Drivers Supported

Currently WebDriver Manager supports Chrome (chromedriver), Firefox (geckodriver), Internet Explorer (IEDriverServer), and Edge (MicrosoftWebDriver). The support for Internet Explorer and Edge is a bit of a work in progress but, overall, they should work in terms of getting the appropriate driver.

Logging

You can enable logging with WebDriver Manager with a command like this:

WebDriverManager.logger.level = :debug

There are debug statements in the code base that will show you what's happening as WebDriver Manager operates. But you are free to add your own messages as well. For example, you could set the logging level to info and then add your own messages:

WebDriverManager.logger.level = :info
WebDriverManager.logger.info("Some Information")

You can also set the logging output to a file:

WebDriverManager.logger.output = 'webdriver_manager.log'

How It Works

WebDriver Manager works by providing an additional implementation to the @driver_path variable that Selenium uses when establishing an instance of a driver. For example, the Chrome implementation simply takes in a path for the driver. This gem overrides that with its own specific functionality for providing a standard path and making sure the relevant binaries are on that path and downloading them if not.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec:all to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jeffnyman/webdriver_manager. The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another testing tool. As such, contributors are very much welcome but are expected to adhere to the Contributor Covenant code of conduct.

To contribute to WebDriver Manager:

  1. Fork the project.
  2. Create your feature branch. (git checkout -b my-new-feature)
  3. Commit your changes. (git commit -am 'new feature')
  4. Push the branch. (git push origin my-new-feature)
  5. Create a new pull request.

Author

Credits

There is a good Python project called webdriver_manager as well as a Java project WebDriverManager. This is my attempt to provide the same functionality in a Ruby context. I'm relying, as inspiration, on Titus Fortner's webdrivers project while trying to update some aspects of, including a cleanup of the overall code base.

License

WebDriver Manager is distributed under the MIT license. See the LICENSE file for details.

webdriver_manager's People

Contributors

jeffnyman avatar rajatthareja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ivanroma20

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.