Skip to content

Instantly share code, notes, and snippets.

View jarib's full-sized avatar

Jari Bakken jarib

View GitHub Profile
Error: DomMessenger is not defined
Source File: chrome://fxdriver/content/server.js
Line: 36
=============
Supported interfaces: nsIException, nsIXPCException, nsIClassInfo, nsISupports,
class WebDriver::Remote::Bridge
command :addCookie, :post, "session/:session_id/:context/cookie"
command :goBack, :post, "session/:session_id/:context/back"
command :clearElement, :post, "session/:session_id/:context/element/:id/clear"
command :clickElement, :post, "session/:session_id/:context/element/:id/click"
command :close, :delete, "session/:session_id/:context/window"
command :getCurrentUrl, :get, "session/:session_id/:context/url"
command :deleteAllCookies, :delete, "session/:session_id/:context/cookie"
command :deleteCookie, :delete, "session/:session_id/:context/cookie/:name"
command :dragElement, :post, "session/:session_id/:context/element/:id/drag"
MAX_THREADS = 4
threads = []
MAX_THREADS.times do
threads << Thread.new do
browser = Celerity::Browser.new
browser.goto "..."
# etc.
$ jruby --version
jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]
$ time jruby -S rake spec
(in /Users/jarib/src/git/celerity)
.......[2009-10-27 13:33:01] INFO WEBrick 1.3.1
[2009-10-27 13:33:01] INFO ruby 1.8.6 (2009-06-15) [java]
[2009-10-27 13:33:01] INFO WEBrick::HTTPProxyServer#start: pid=11413 port=2001
127.0.0.1 - - [27/Oct/2009:13:33:01 CET] "GET http://0.0.0.0:2000/ HTTP/1.1" 200 17
- -> http://0.0.0.0:2000/
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
The format of the args argument is that it is an array containing, in the order passed to the function, wrapped arguments. The form of wrapped arguments is:
wrap("string") = {"type": "STRING", value: "string"}
wrap(true) = {"type": "BOOLEAN", value: true}
wrap(7) = {"type": "NUMBER", value: 7}
wrap(7.1) = {"type": "NUMBER", value: 7.1}
class Radio < Element
identifier :tag_name => 'input', :type => 'radio'
method_name :radio
collection_method_name :radios
# core
attributes :class, :id, :style, :title,
# i18n
:dir, :lang,
<li class="chassi">
<span class="image">
<a style="cursor: pointer" onclick="dcsMultiTrack('DCS.dcsuri','/finn/motor/browse1/Cabriolet','WT.ti','FINN motor browse1 karosseritype: Cabriolet'); return true;" href="/finn/car/used/result?BODY_TYPE=7" rel="nofollow">
<img border="0" src="http://devcache.finn.no/img/motor/chassi/7.png" alt="Velg karosseri"/>
</span>
<span class="text">
Cabriolet
<br>
(699)
</a>
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
public class FailingPasswordField {
public static void main(String[] args) throws Exception {
WebClient wc = new WebClient();
HtmlPage page = wc.getPage("file:///tmp/form.html");
# Visit the www.guardian.co.uk front page, and get the text of the body element 5 times.
# Time spent launching the browser and loading the page is not counted.
Rehearsal --------------------------------------------
chrome: 0.010000 0.010000 0.020000 ( 9.701344)
firefox: 0.070000 0.160000 107.700000 (128.759095)
--------------------------------- total: 107.720000sec
user system total real
chrome: 0.020000 0.020000 0.040000 ( 9.041230)