Giter VIP home page Giter VIP logo

watir.github.io's Introduction

watir

Watir Powered By Selenium!

Gem Version Chrome Tests Edge Tests Firefox Tests IE Tests Safari Tests Unit Tests

Using Watir

This README is for people interested in writing code for Watir or gems in the Watir ecosystem that leverage private-api Watir code.

For our users, everything you'll need is on the Watir website: examples, news, guides, additional resources, support information and more.

Procedure for Patches/Pull Requests

  • Fork the project.
  • Clone onto your local machine.
  • Create a new feature branch (bonus points for good names).
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so we don't unintentionally break it in a future version.
  • Commit, do not change Rakefile, gemspec, or CHANGES files, we'll take care of that on release.
  • Make sure it is passing doctests.
  • Make sure it is passing rubocop.
  • Push to your forked repository.
  • Send a pull request.

Developing Extensions

When developing a gem intended to be used with Watir, you can run your code with WatirSpec to make sure that requiring your code does not break something else in Watir.

First, add WatirSpec Rake tasks to your gem:

# Rakefile
require 'watirspec/rake_tasks'
WatirSpec::RakeTasks.new

Second, initialize WatirSpec for your gem:

$ bundle exec rake watirspec:init

This command will walk you through how to customize your code.

Automatic Element Generation

The majority of element methods Watir provides is autogenerated from specifications. This is done by extracting the IDL parts from the spec and processing them with the WebIDL gem.

Generated elements are currently based on the following specifications:

  • HTML (lib/watir/elements/html_elements.rb)
  • SVG (lib/watir/elements/svg_elements.rb)

To run:

$ bundle exec rake html:update
$ bundle exec rake svg:update

Specs

Github Actions

Watir specs are run with Github Actions.

Watir code is tested on Linux with latest versions of supported browsers and all active Ruby versions.

Doctests

Watir uses yard-doctest to directly test our documentation examples.

mkdir ~/.yard
bundle exec yard config -a autoload_plugins yard-doctest
rake yard:doctest

Coveralls

Watir code is run through Coveralls to encourage PRs to ensure all paths in their code have tests associated with them.

Rubocop

Watir is using Rubocop to ensure a consistent style across the code base. It is run with our minimum supported Ruby version (2.3) We have some established exceptions at .rubocop.yml that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.

Statistics

Element specs are run with Selenium Statistics gem to verify that changes to the code do not dramatically decrease the performance based on wire calls.

Copyright

See LICENSE for details

watir.github.io's People

Contributors

3lackros3 avatar abaird avatar agodwin avatar barryclark avatar bluephoenix avatar bret avatar bwilczek avatar chrismcmahon avatar coltonfitzgerald avatar dijonkitchen avatar dmcnulla avatar eringrand avatar hasis avatar javiercejudo avatar jkotests avatar kapoorlakshya avatar maccracken avatar neudabei avatar ojab avatar omgmog avatar p0deje avatar peteretelej avatar pudlovich avatar rnicholus avatar sukendhar avatar sunnankar avatar thekiiingbob avatar titusfortner avatar ttilberg avatar twangyourmechanic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

watir.github.io's Issues

Remove Stack Overflow Teams link

The Stack Overflow Teams project has ended. As a result, clicking the link in the footer goes to a general "Teams has un-shipped" page.

We should remove the link in the footer.

Mobile Support

This site does not have mobile css, and does not look good on a phone.

Can't confirm Javascript alerts on IE 11, instead watir dismisses

OS: Win 7 Enterprise 64bit
IE 11.0.9600.18617
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
watir 6.2.0
IEDriverServer 3.3.0 32bit

browser.alert.exists? would dismiss the alert rather than not. It does return true for the first call though. Any attempt to handle alert will close it. This means ok or confirm cannot be clicked.

Possible things to add to the website

We already have Watir and Watir-Webdriver that we are looking to merge into this site. Much of that information is outdated, but not all of it.

Things we should consider adding to the site:

  1. Updated Formatting (aka make it pretty)
  2. About information (Team page? / Support Page?)
  3. Copy over old blog posts
  4. Copy over links to old podcasts
  5. History Page / Watir-Classic Page
  6. List of companies using Watir
  7. Move over all the 'advanced guides' from watirwebdriver.com

3rd Party Gems

Where do we want to document 3rd Party gems? On the website or in github readme?

I noticed there are a bunch here that should be put somewhere else one way or another.

Remote Servers

Need explanation and examples of how to use Watir with Remote servers
Can also discuss sauce labs integration, etc.

Redirect Old Sites

Theoretically (I'm not sure how implementing these will work) there are two options for url redirection

  1. Redirect the entire domain, usually done through the domain registrar, which may or may not be WordPress. it will try to map http://watir.com/x/y/z.html to http://watir.github.io/x/y/z.html so almost all of the links to watir.com will hit a 404 page on watir.github.io. Which is why #44
  2. Redirect each page individually: This would be a pain, but theoretically we could update each and every page from the old site to the right page on the new site:
    <meta http-equiv="refresh" content="0; URL='http://new-website.com'" />
    I have no idea if/how easily we can do this on wordpress sites, but it would theoretically be kinder to everyone who has ever linked to one of our pages.

Element Location Examples

We should have more articles on the site giving real examples of all the ways that elements can be located.

Simplify archives

There are two ways of doing this:

  1. Paginating the posts
  2. Using a date filter on the sidebar

As result, we'll remove the archives that are currently with different yearly files.

Watir support for Edge browser

I am trying to run my script in Edge browser using watir and selenium grid 2.53.1 . On running the grid console shows that the edge browser has got allocated, but it doesnt run any of the test.

It throws the below error

"["[remote server] sun.reflect.NativeConstructorAccessorImpl():-2:in newInstance0'\", \"[remote server] sun.reflect.NativeConstructorAccessorImpl():-1:innewInstance'", "[remote server] sun.reflect.DelegatingConstructorAccessorImpl():-1:in newInstance'\", \"[remote server] java.lang.reflect.Constructor():-1:innewInstance'", "[remote server] org.openqa.selenium.remote.ErrorHandler(ErrorHandler.java):206:in createThrowable'\", \"[remote server] org.openqa.selenium.remote.ErrorHandler(ErrorHandler.java):158:inthrowIfResponseFailed'", "[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):678:in execute'\", \"[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):249:instartSession'", "[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):131:in <init>'\", \"[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):144:in'", "[remote server] org.openqa.selenium.edge.EdgeDriver(EdgeDriver.java):152:in <init>'\", \"[remote server] org.openqa.selenium.edge.EdgeDriver(EdgeDriver.java):120:in'", "[remote server] sun.reflect.NativeConstructorAccessorImpl():-2:in newInstance0'\", \"[remote server] sun.reflect.NativeConstructorAccessorImpl():-1:innewInstance'", "[remote server] sun.reflect.DelegatingConstructorAccessorImpl():-1:in newInstance'\", \"[remote server] java.lang.reflect.Constructor():-1:innewInstance'", "[remote server] org.openqa.selenium.remote.server.DefaultDriverProvider(DefaultDriverProvider.java):103:in callConstructor'\", \"[remote server] org.openqa.selenium.remote.server.DefaultDriverProvider(DefaultDriverProvider.java):97:innewInstance'", "[remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):60:in newInstance'\", \"[remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):222:incall'", "[remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):1:in call'\", \"[remote server] java.util.concurrent.FutureTask():-1:inrun'", "[remote server] org.openqa.selenium.remote.server.DefaultSession$1(DefaultSession.java):176:in run'\", \"[remote server] java.util.concurrent.ThreadPoolExecutor():-1:inrunWorker'", "[remote server] java.util.concurrent.ThreadPoolExecutor$Worker():-1:in run'\", \"[remote server] java.lang.Thread():-1:inrun'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/response.rb:70:in assert_ok'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/response.rb:34:ininitialize'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/http/common.rb:78:in new'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/http/common.rb:78:increate_response'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/http/default.rb:90:in request'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/http/common.rb:59:incall'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/bridge.rb:649:in raw_execute'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/bridge.rb:123:increate_session'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/remote/bridge.rb:87:in initialize'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/driver.rb:59:innew'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver/common/driver.rb:59:in for'\", \"C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.53.1/lib/selenium/webdriver.rb:84:infor'", "C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-webdriver-0.9.3/lib/watir-webdriver/browser.rb:46:in initialize'\", \"C:/Users/xyz/codes/ruby/lib/ci_utilities.rb:246:innew'", "C:/Users/xyz/codes/ruby/lib/ci_utilities.rb:246:in block in assign_browser'\", \"C:/Users/xyz/codes/ruby/lib/ci_utilities.rb:243:ineach'", "C:/Users/xyz/codes/ruby/lib/ci_utilities.rb:243:in assign_browser'\", \"C:/Users/xyz/codes/ruby/vdeck/registration/hosting_registration.rb:90:in

'"]"
"Unknown error (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 7.06 seconds\nBuild info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'\nSystem info: host: 'CPU1157', ip: '10.0.1.14', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_31'\nDriver info: org.openqa.selenium.edge.EdgeDriver (org.openqa.selenium.WebDriverException)"

Currently I haven't mentioned any browser capabilities.

if opts['browser_selection'] =~ /edge/i
      p 'edge'
      browser_capabilities[:browserName] = 'MicrosoftEdge'
end

browser = Watir::Browser.new(:remote,
                   :url => "http://#{hub}:4444/wd/hub",
                  :desired_capabilities => browser_capabilities )`

Selenium hub and node are configured as below

REM Settings as a hub
start java -jar selenium-server-standalone-2.53.1.jar -role hub -port 4444 -DPOOL_MAX=512

REM Setting as a node
start java -Dwebdriver.chrome.driver=C:\seleniumgrid\chromedriver.exe -Dwebdriver.edge.driver=C:\seleniumgrid\MicrosoftWebDriver.exe -Dwebdriver.ie.driver=C:\seleniumgrid\IEDriverServer.exe -jar selenium-server-standalone-2.53.1.jar -role node -port 5556 -hub http://localhost:4444/grid/register -browser browserName=MicrosoftEdge,platform=WINDOWS,maxInstances=2 -browserTimeout 500 -browser browserName="internet explorer",version=11,maxInstances=2,platform=WINDOWS -browser browserName=chrome,maxInstances=2,platform=WINDOWS -browser browserName=firefox,maxInstances=2,platform=WINDOWS -log C:\seleniumgrid\node1.log
`

Are there any specific capabilties which needs to be mentioned while running Edge browser with watir?

Updated 404 Page

Depending on how we redirect the old sites, we might want a more custom 404 page explaining that old sites went away and that the links are stale.

Book Reviews

There are a number of Watir related books out there. Would be nice to have book reviews and recommendations on our website as well. Just an idea.

Recommended Gem

Someone just asked in Slack what gem they should be using because they have 4 currently installed (watir-webdriver, watir, watircommon & watir-classic).

I think a link on the main page of what the current recommended gem to use would be good. We can keep that updated when we do new releases.

Especially before we release 6.0 it is a little confusing still.

Guide pages are 404'ing.

This all worked locally when I tested it, but now that it's "live", the /docs/ pages do not pull up.

Parity with Watir.com and Watir-webdriver.com

Most of the topics from the old websites should be updated and ported to the new website. Historical blog posts should be ported over. Comments on posts don't need to be ported, although it would certainly be nice to have them.

Change Readme

It's only seen on this repo, not the actual site, but it should get changed away from the Jekyll Now default.

Fix Community Page

Something got hosed on the community page when it renders on the actual github site. I'm seeing HTML code in various places and links in spans aren't rendering.

Add commenting

It seems like Disqus is the right tool for comments these days and there are tutorials out there for how to integrate with Jekyll. Ideally we would port over the old comments from the wordpress sites to attach to the blog posts that re ported over.

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.