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
JsshSocket::JSReferenceError: alert is not defined
which is kind of strange because other expressions like
f.js_eval("document.location.toString();")
Work like a charm!
Anyone with a hint?
Thanks and greets,
Joe
If you want to use it like you would normally with a $ you need to wrap it in a function which will run it on the context of the widows document.
var win = new getWindows()[0].content;
var doc = browser.contentDocument;
$ = function(selector) {
win.content.jQuery(selector, doc);
}
chicago web design
Okay folks,
i got jQuery working with a lot of researching and I hope this will be help you out if you have similar problems:
firefox.js_eval("var target = getWindows()[0]; target.content.jQuery('#selector').toggle()")
What i had to do was to select the window I am working in explicitly and within its content jQuery is available and one is able to use all of its awesomeness! ;)
Greetings Joe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With