GithubHelp home page GithubHelp logo

safariwatir's Introduction

“There’s something eerily tingly about seeing a browser run by itself.” twitter.com/swombat/status/1280692921

SafariWatir

DESCRIPTION:

We are putting Watir on Safari. The original Watir (Web Application Testing in Ruby) project supports only IE on Windows. This project aims at adding Watir support for Safari on the Mac.

Requirements

Mac OS X running Safari. Some features require you to turn on “Enable access for assistive devices” in System Preferences > Universal Access.

SYNOPSIS:

require 'rubygems'
require 'safariwatir'

browser = Watir::Safari.new
browser.goto("http://google.com")
browser.text_field(:name, "q").set("obtiva")
browser.button(:name, "btnI").click
puts "FAILURE" unless browser.contains_text("software")

INSTALL:

 [sudo] gem install safariwatir

or

 git clone git://github.com/redsquirrel/safariwatir.git
 cd safariwatir
 git submodule update --init
 rake install

RUNNING SAFARIWATIR AGAINST WATIRSPEC

git clone git://github.com/redsquirrel/safariwatir.git
cd safariwatir
git submodule update --init
spec spec

CONTRIBUTING:

WatirSpec is the emergent standard for the Watir API. We do not currently support all of the functionality described by WatirSpec. A good way to contribute would be to fix a few failing specs as defined by WatirSpec. See “Running SafairWatir Against WatirSpec” to get started.

safariwatir's People

Contributors

aesterline avatar bhuga avatar caius avatar careo avatar charley avatar jubishop avatar mpeychich avatar myobie avatar redsquirrel avatar richardlawrence avatar treye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

safariwatir's Issues

Can't locate by name with nested array

Given the site http://www.pastie.org/

and the form field

 <textarea class="pastebox" cols="40" id="paste_body" name="paste[body]" rows="22" tabindex="20"></textarea>

this test fails:

 require 'watir'
 b = Watir::Safari.new
 b.goto "http://www.pastie.org"
 b.text_field(:name, "paste[body]").set "Foo"

You get

Watir::Exception::UnknownObjectException: Unable to locate TextField element with id of paste_name
from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir/scripter.rb:521:in execute' from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir/scripter.rb:174:infocus'
from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir.rb:382:in `set'
from (irb):7

However it works if you address it by id.

 b.text_field(:id, "paste_body").set "Foo"

Although you do see this:

  => :missing_value

and I don't know what that's supposed to mean :)

Started looking through the source code and I had no idea why this wouldn't work. This is still the case with the gem I built today from github (0.3.5)

No element_by_xpath support?

Trying to run a new WATIR test that runs on Firewatir and I get:

NoMethodError: undefined method element_by_xpath' for #<Watir::Safari:0x10161f308> ./UserSPlogin.rb:29:inusersplogin'
Misc.rb:18:in `test_00001_UserSPlogin'

BuildError couldn't understand kern.osversion `14.3.0'

I'm having trouble installing this gem on Yosemite 10.10.3.

Getting the error:

Building native extensions.  This could take a while...
ERROR:  Error installing safariwatir:
    ERROR: Failed to build gem native extension.

    /Users/stevenspiel/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150615-63123-lm07gr.rb extconf.rb
extconf.rb:44:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:44:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
create /Users/stevenspiel/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rb-appscript-0.6.1/src/osx_ruby.h ...
create /Users/stevenspiel/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rb-appscript-0.6.1/src/osx_intern.h ...
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling src/rbae.c
couldn't understand kern.osversion `14.3.0'
In file included from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:55,
                 from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
                 from src/rbae.c:13:
/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:262: error: expected ‘,’ or ‘}’ before ‘__attribute__’
/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:414: error: expected ‘,’ or ‘}’ before ‘__attribute__’
make: *** [rbae.o] Error 1

make failed, exit code 2

Any clue as to what might be causing this?

undefined method `is_frame?

I have try this

browser.link(:id, "aboutButton").click

but have an error.

what's happen ?

/Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:672:in`element_not_found_exception': undefined method `is_frame?' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:661:in`execute'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:477:in `click_link'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:697:in`page_load'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:476:in `click_link'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:336:in`click'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:317:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:317:in`highlight'
    from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:335:in `click'
    from test.rb:7

0.4.0 cause Safari crash too offend

After update from 0.3.8 to 0.4.0 all my mac with Safari 5.0.2 (6533.18.5) crash randomly.
I can't make my all my test pass. every time the crash occur it's in different action. And I can run test pass at the specific point. Now I have try quit safari every feature but still not good enough.

Error installing watir

When I try to install watir I have the following error:

$ gem install watir
Building native extensions.  This could take a while...
ERROR:  Error installing safariwatir:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.4.0/gems/rb-appscript-0.6.1
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170123-96895-5xx3by.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/Cellar/ruby/2.4.0/bin/$(RUBY_BASE_NAME)
extconf.rb:44:in `<main>': uninitialized constant Config (NameError)
Did you mean?  RbConfig
               CONFIG

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/rb-appscript-0.6.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-15/2.4.0/rb-appscript-0.6.1/gem_make.out

My configuration:

  • MacOS 10.11.6
  • Ruby 2.4.0p0
  • Gem 2.6.8

Multiple parameters?

I've written a simple dsl that a nice abstraction over Xwatir. The dsl always passes a has to the method. For example:

button(:id => 'some_id') OR button(:id => 'some_id', :index => 1)

This works fine on Watir and Firewatir but fails in Safariwatir.

Further Installation Reqs?

I attempted to install via the steps in the Readme.

git...; cd...; rake install

The install failed:

macbook:safariwatir John$ rake install
(in /Users/John/safariwatir)
rake aborted!
no such file to load -- echoe
/Users/John/safariwatir/Rakefile:3
(See full trace by running task with --trace)

I resolved this by installing the dependency 'echoe' through gem and reran rake.

The install failed again, complaining thus:

:safariwatir John$ rake install
(in /Users/John/safariwatir)
Missing manifest. You can build one with 'rake manifest'.

So I ran 'rake manifest':

:safariwatir John$ rake manifest
(in /Users/John/safariwatir)
Cleaning
Building Manifest

  • Manifest
  • README.rdoc
  • Rakefile
  • lib/safariwatir.rb
  • lib/safariwatir/core_ext.rb
  • lib/safariwatir/scripter.rb
  • lib/watir/exceptions.rb
  • safariwatir_example.rb

and then reran 'rake install'. The gem installed correctly at that point.

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.