watir

How to Instantiate/Run a Ruby program (uses Watir) using Linux?

Scenario : I mapped a network drive on a Win XP machine and I double click a .bat file to execute this Ruby script. The .rb and .bat file reside on this networked drive. The batch file is as follows : Z: cd Z:\ABC\StatusCheck\ "C:\Program Files\Ruby\Bin\ruby.exe" Z:\ABC\StatusCheck\rubyScript.rb 6 The Ruby file is as follows : requ...

Is Watir only for Ruby applications?

Or can it be used to automate websites made with other technologies as well? ...

Ruby Watir: Clicking OK on JavaScript Alerts?

Seems none of the code I've tried has any affect. My intention is to close any and all JavaScript prompts that may come up by hitting the "OK" button. Problem is, my script has no affect on the prompts that come up. In other words, it does nothing. Here's what I have: fx = FireWatir::Firefox.start(somepage) fx.startClicker("OK") fx.but...

How to get an element using inner text (Watir, Nokogir, Hpricot)

I have been expeirmenting with Watir, Nokogir and Hpricot. All of these use top->down approach which is my problem. i.e. they use element type to search element. I want to find out the element using the text without knowing element type. e.g. <element1> <element2> Text2 </element2> <element3> Text3 </element3> text4 </elem...

FireWatir and jQuery

Hello there, after using this excellent peace of software called FireWatir, I wonder if there is a way to integrate jQuery-selector-magic to my test. My first attempt is to use firewatir's js_eval() method like this require 'rubygems' require 'firewatir' f = FireWatir::Firefox.new f.js_eval("alert(42);") The only thing I get is a ...

safariwatir: how to select anonymous button

I'm using watir for safari with ruby 1.8.7 on OSX Snow leopard. I want to click a button, the only one in the page, that has neither id nor name. It only has an onckick property and the text within the tag.. How to do that? Is there a way to list all buttons on the page, and get the first (and only) one? thanks ...

How to script elements embedded within an <iFrame> tag?

Hi, I am using Firefox and i have a page which has an <iframe> Tag. The contents embedded within this tag cannot be seen from normal "View Page source" option. So i installed Firebug plugin and i can get see the contents using Firebug. My issue is, i cannot script any of these elements using FireWatir. Anybody has any ideas how to do...

Mouse movement / mouseover and JavaScript evaluation in watir

I have a JavaScript-heavy Rails app which I am testing in watir. I have two specific testing requirements: I need to be able to simulate moving the mouse to a specific area of the screen (or at least triggering the onmouseover event for a div) Evaluating a snippet of JavaScript once the above has happened to see if a flag is set correc...

How to handle User "confirmation" with Watir/Cucumber?

I'm new to Watir and I've having a little trouble getting logged in in my tests. I use authlogic as my authentication method of choice. When a User registers, they are sent an email with a confirmation link. Clicking this link confirms their account and they can then login. The issue I'm having is how do I confirm the User when using Wa...

How to do Basic Authentication using FireWatir on Ubuntu Linux?

Hi, I'm trying to use FireWatir (1.6.5) to access a site using Basic Authentication and I've been unable to find a solution that works on Firefox in Linux. Does FireWatir 1.6.5 support Basic Authentication on Linux? I've been searching the web for 2 days and can't get a straight answer anywhere as to how to do this. The only thread I...

Testing Watir on Firefox throws JsshSocket::JSReferenceError

I am using Watir on Windows and when my script tries to run on Firefox, I see this error on my console: JsshSocket::JSReferenceError: Components is not definedReferenceError: Components is not defined C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/jssh_socket.rb:12:in `js_eval' C:/xampp/Ruby/lib/ruby/gems/1....

Running rspec against multiple targets

I've written an rspec test using Watir against a web application and it's running fine. However, I now want to be able to run this test against the web application running on different domain names. My initial thought was that I'd be able to pass a value to spec at the command line to set a variable within my script, but I can't see an...

Watir question regarding exist on a class for testing purposes.

I have a button on my page that changes depending on what radio button is clicked. The button has the same text on it with the same id, but different classes. How do I test if the two different buttons exist depending on the radio. <a id="submit" class="on" href="javascript:submit();">Submit</a> <a id="submit" class="off" href="javascri...

Watir::IE.attach(:title,/x/) not working correctly on Win 7 IE8

System: Window 7 Internet Explorer 8 Ruby 1.8 Watir 1.6.5 If I manually open a browser window and then visit a site that causes a second browser window to open and then use the Watir::IE.attach method to find the second browser window everything work fine. The problem is when I open the first Internet Explorer window with the command...

How to upload a file with watir and IE?

I am writing a watir script to test an upload form. But the script does not automatically choose the file that is to be uploaded from my harddrive. Instead IE stops with the file chooser dialog open. As soon as I manually select the to be uploaded file in the dialog and click ok, watir continues as desired. I wonder why it stops. This...

How do I get the id or name of an element in watir?

Watir can find a text on a page: <span id="i1" name="n1>Some Text</span> e.text.include?("Some Text") But how can I get the name or id of the span, when I only know "Some Text" e.text.findInPage("Some Text").parentElement.id (should be "i1") e.text.findInPage("Some Text").parentElement.name (should be "n1"); Something like this ex...

Cannot select radio button that was added by JavaScript in watir

This was added to the page later with jQuery: <input name="pdfRadio" id="pdfRadioNo0" value="0" type="radio"> This code: radio_id = "pdfRadioNo0" ie.radio(:id, radio_id).set() does not set it but returns an error message: Watir::Exception::UnknownObjectException: Unable to locate element, using {:id=>"pdfRadioNo0"} Does watir al...

Testing "Login" with watir

I'm starting to use watir. I need to create a test script to login in the application. The code bellow is the script from the page. I saw some examples with buttons and links, but I don't know how to "submit"("onclick=SubmitForm() type=button value="Sign In") the information. ...

Does watir's browser.text.include? count text inside invisible divs? If so, how to search only for visible text?

Does watir's browser.text.include? count text inside invisible divs? If so, how to search only for visible text? I put all the instructions into the html from the beginning and use jQuery to hide and unhide the relevant parts. How can I use watir's waiter to wait for only text that is visible? My problem is, that the waiter always re...

Watir: Need to double click on an element to open custom popup

Hello, I am a newbie in WATIR. The problem I am facing is - The application I am testing has thumbnails (like Windows icons) placed on the page and I need to double click it. On doing that, an custom popup (ajax popup implemented in javascript) will open. The fire_event("ondblclick") is not working for me. I also tried 'click' twice bu...