Skip to content

Instantly share code, notes, and snippets.

View jarib's full-sized avatar

Jari Bakken jarib

View GitHub Profile
# java -jar third_party/jruby/jruby-complete-1.4.0RC1.jar guardian.rb [chrome|firefox]
$LOAD_PATH << "common/src/rb/lib"
$LOAD_PATH << "firefox/src/rb/lib"
$LOAD_PATH << "chrome/src/rb/lib"
require "rubygems"
require "selenium/webdriver"
browser = (ARGV.first || :firefox).to_sym
{"error":true,"value":"{\"message\":\"java.lang.NullPointerException\",\"localizedMessage\":\"java.lang.NullPointerException\",\"cause\":{\"class\":\"java.lang.NullPointerException\",\"stackTrace\":[{\"fileName\":\"DriverFactory.java\",\"class\":\"java.lang.StackTraceElement\",\"lineNumber\":76,\"className\":\"org.openqa.selenium.remote.server.DriverFactory\",\"methodName\":\"newInstance\",\"nativeMethod\":false},{\"fileName\":\"Session.java\",\"class\":\"java.lang.StackTraceElement\",\"lineNumber\":50,\"className\":\"org.openqa.selenium.remote.server.Session$1\",\"methodName\":\"call\",\"nativeMethod\":false},{\"fileName\":\"Session.java\",\"class\":\"java.lang.StackTraceElement\",\"lineNumber\":48,\"className\":\"org.openqa.selenium.remote.server.Session$1\",\"methodName\":\"call\",\"nativeMethod\":false},{\"fileName\":\"FutureTask.java\",\"class\":\"java.lang.StackTraceElement\",\"lineNumber\":303,\"className\":\"java.util.concurrent.FutureTask$Sync\",\"methodName\":\"innerRun\",\"nativeMethod\":false},{\"
org/openqa/selenium/remote/RemoteWebDriver.java:428:in `throwIfResponseFailed': java.lang.RuntimeException: <html> (NativeException)
<head>
<title>Error 403 Forbidden for Proxy</title>
</head>
<body>
<h2>HTTP ERROR: 403</h2><pre>Forbidden for Proxy</pre>
<p>RequestURI=/wd/hub/session</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>
>> driver = Selenium::WebDriver::Driver.new(Selenium::WebDriver::Firefox::Bridge.new)
=> #<Selenium::WebDriver::Driver:0x102284c10 browser=:firefox>
>> driver.execute_script("window.open('http://www.google.com')")
=> nil
>> driver.window_handles
=> ["{4184fcf9-103d-5c4a-9c96-3aa6a4ad501f}", "{20f5ae36-fcd8-3949-a1f7-33cb0cae2a98}"]
>> driver.quit
=> nil
jarib :: ~/src/git/selenium2> rake test_remote
(in /Users/jarib/src/git/selenium2)
No srcs specified for selenium-core
No srcs specified for debug_jsapi
Building: webdriver-remote-common as build/webdriver-remote-common.jar
javac -cp build/webdriver-common.jar:build/webdriver-remote-common.jar:remote/common/lib/runtime/commons-codec-1.4.jar:remote/common/lib/runtime/json-20080701.jar:third_party/java/google-collect-1.0-rc3.jar -g -source 5 -target 5 -d build/webdriver-remote-common.jar_classes remote/common/src/java/org/openqa/selenium/remote/BeanToJsonConverter.java remote/common/src/java/org/openqa/selenium/remote/Capabilities.java remote/common/src/java/org/openqa/selenium/remote/Command.java remote/common/src/java/org/openqa/selenium/remote/Context.java remote/common/src/java/org/openqa/selenium/remote/DesiredCapabilities.java remote/common/src/java/org/openqa/selenium/remote/DriverCommand.java
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000020
0x000000010005a314 in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x10509fea0, call_frame=0x7fff5fbf6680, args=@0x7fff5fbf69b0) at instruction_implementations.hpp:854
854 if(cache->update_and_validate(state, call_frame, recv) &&
(gdb) bt
#0 0x000000010005a314 in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x10509fea0, call_frame=0x7fff5fbf6680, args=@0x7fff5fbf69b0) at instruction_implementations.hpp:854
#1 0x00000001000f6607 in rubinius::VMMethod::execute_specialized<rubinius::NoArguments> (state=0x100f04b00, previous=0x7fff5fbf6a40, msg=@0x1050a0f40, args=@0x7fff5fbf69b0) at vm/vmmethod.cpp:547
#2 0x000000010005875b in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x1050a0dc0, call_frame=<value temporarily unavailable, due to optimizations>, args=@0x7fff5fbf6d60) at instruction_implementations.hpp:497
#3 0x00000001000f6907 in rubinius::VMMetho
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000020
0x000000010005a314 in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x104d7a6b0, call_frame=0x7fff5fbf6820, args=@0x7fff5fbf6b50) at instruction_implementations.hpp:854
854 if(cache->update_and_validate(state, call_frame, recv) &&
(gdb) bt
#0 0x000000010005a314 in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x104d7a6b0, call_frame=0x7fff5fbf6820, args=@0x7fff5fbf6b50) at instruction_implementations.hpp:854
#1 0x00000001000f6607 in rubinius::VMMethod::execute_specialized<rubinius::NoArguments> (state=0x100f04b00, previous=0x7fff5fbf6be0, msg=@0x104d7b2f0, args=@0x7fff5fbf6b50) at vm/vmmethod.cpp:547
#2 0x000000010005875b in rubinius::VMMethod::interpreter (state=0x100f04b00, vmm=0x104d7b210, call_frame=<value temporarily unavailable, due to optimizations>, args=@0x7fff5fbf6f00) at instruction_implementations.hpp:497
#3 0x00000001000f6907 in rubinius::VMMetho
@jarib
jarib / file.rb
Created January 19, 2010 11:13
FFI wrapper for CreateProcess()
require "rubygems"
require "ffi"
module WinProcess
extend FFI::Library
ffi_lib "kernel32"
ffi_convention :stdcall
class Error < StandardError
class Site
def initialize(browser)
@browser = browser
end
def some_page
SomePage.new @browser
end
We couldn’t find that file to show.