Someone working on hooking up Watir and Firefox

Alex Fritze, author of jssh, pointed Angrez Singh to me. Angrez is working on extending Watir to drive Firefox, and he’s using jssh for the control channel.

At first, Angrez just had general questions about building the extension version of jssh, and why his Firefox builds were called “DeerPark”.

As we exchanged more mail, I was able to help get him answers to more complex questions, one of which involved the “browse” button for the input type=”file” picker. He also sent me the code he’s written so far, and I’m anxious to try it out.

I see that he is still using AutoIt to send key events, which is a Windows-only tool. Maybe I can find someone who knows how to do that using jssh, so this solution will be totally cross-platform (win, mac, linux).

Right now, Firefox does not ship with a remote-control interface such as the one Watir uses to contol IE. Using jssh seems like the least amount of effort to get something good-enough up and running. Eventually, I hope to see, and maybe work on, adding such a thing to our production code.

In the meantime, I look forward to playing with Watir and Firefox.

2 Responses to “Someone working on hooking up Watir and Firefox”

  1. mixedpuppy says:

    using dom events you can do the key events just fine with the exception that in some ui elements they will not work, such as:

    win32 and osx file dialogs plugins that use real os events

    also, I have not tested anything like IME with this yet, which uses the text event (see below). The other problem is knowing what the target element is. Watir may not be able to use this at all. The best solution would be sending real events, but that is a bit more work to cover all platforms, and would be mozilla specific.

    (hope the pre tag works here)

    keyEvent = function(target, evt)
    {
        if (!target)
          return;
        var event = target.ownerDocument.createEvent("KeyEvents");
        event.initKeyEvent(evt.type, evt.bubbles, evt.cancelable,
                           target.ownerDocument.defaultView, evt.ctrlKey, evt.altKey, evt.shiftKey,
                           evt.metaKey, evt.keyCode, evt.charCode);
        target.dispatchEvent(event);
    }
    
  2. [...] Angrez has written Ruby scripts which enable this thing to drive FireFox. Great! He is using JSSh to control FireFox from Ruby. Here and here are more discussions about this. [...]