Skip to content

Instantly share code, notes, and snippets.

@bbbco
bbbco / swd_template.rb
Last active December 19, 2015 18:49
Selenium WebDriver for Ruby Bindings quick script template; based on @jarib's SWD template
require 'rubygems'
require 'selenium-webdriver'
browser = Selenium::WebDriver.for :firefox # replace :firefox with the browser you're having trouble with
begin
browser.get # <= Add your url here
# your code here
ensure
browser.quit
@bbbco
bbbco / segfault.log
Created July 10, 2013 14:06
Segfault that occasionally occurs upon completion of Minitest
Finished in 1832.41581s
25 tests, 1053 assertions, 0 failures, 2 errors, 1 skips
Writing XML reports to /cruisedata/jenkins-slave/workspace/SeleniumNewTests/selenium/rb/test/reports
I, [2013-07-10T08:31:27.387315 #24977] INFO : Killing browser
/home/site/.rvm/gems/ruby-1.9.3-p385@rn_qa/gems/minitest-4.7.0/lib/minitest/unit.rb:775: [BUG] Segmentation fault
ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0028 s:0006 b:0006 l:0009f8 d:000005 BLOCK /home/site/.rvm/gems/ruby-1.9.3-p385@rn_qa/gems/minitest-4.7.0/lib/minitest/unit.rb:775
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
@bbbco
bbbco / Full Debug with updated SWD 2.33.0
Last active December 19, 2015 01:09
When the first Timeout::Error happens when calling element.attribute("style"), the test fails and tries to execute a teardown method that calls a take_screenshot method if the script had failed. You can see in the second file that the same type of error occurs again during the save_screenshot method call, which makes me wonder if Selenium has no…
-> POST session/1249e4c3-5723-4248-a907-8a1ebb437e3b/element/%7Be0cacf8e-1658-4ee5-9492-d4678a46de5d%7D/elements
>>> http://127.0.0.1:7056/hub/session/1249e4c3-5723-4248-a907-8a1ebb437e3b/element/%7Be0cacf8e-1658-4ee5-9492-d4678a46de5d%7D/elements | {"using":"css selector","value":"#player_about"}
> {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=utf-8", "Content-Length"=>"48"}
Exception `Errno::EAGAIN' at /home/site/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/protocol.rb:141 - Resource temporarily unavailable - read would block
Exception `Errno::EAGAIN' at /home/site/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/protocol.rb:141 - Resource temporarily unavailable - read would block
<- {"name":"findChildElements","sessionId":"1249e4c3-5723-4248-a907-8a1ebb437e3b","status":0,"value":[{"ELEMENT":"{139776ca-1485-4c9d-bb6e-ad0634258557}"}]}
-> POST session/1249e4c3-5723-4248-a907-8a1ebb437e3b/element/%7B139776ca-1485-4c9d-bb6e-ad0634258557%7D/elements
>>> http://127.0.0.1:7
require 'rubygems'
require 'selenium-webdriver'
#path = File.expand_path("test.html")
#File.open(path, "w") { |io| io << DATA.read }
@browser = Selenium::WebDriver.for :firefox # replace :firefox with the browser you're having trouble with
begin
@browser.get "http://www.reverbnation.com"
@bbbco
bbbco / x
Created October 28, 2008 05:27
hyphenate
CmdUtils.CreateCommand( {
name: "hyphenated",
takes: {"phrase": noun_arb_text},
author: {
name: "Brian D. Goad",
email: "bdgoad@gmail.com"},
license: "MPL",
description: "Replaces the spaces in a phrase with a hyphen.",
_hyphenate: function(phrase) {
return phrase.text.replace( / /g, "-", i );
@bbbco
bbbco / x
Created October 23, 2008 19:04
Ubiquity Thesaurus Command
CmdUtils.CreateCommand( {
name: "thesaurus",
takes: {search: noun_arb_text},
locale: "en-US",
author: {
name: "Brian Goad",
email: "bdgoad@gmail.com"},
license: "MPL",
icon: "http://www.merriam-webster.com/favicon.ico",
description: "Searches Webster's Thesaurus for your word.",
@bbbco
bbbco / x
Created October 23, 2008 19:01
CmdUtils.CreateCommand({
name: "websource",
homepage: "http://www.briandgoad.com/blog/",
author: { name: "Brian D. Goad", email: "bdgoad@gmail.com"},
description: "Checks Websource.It for a comparison between two terms throughout the web.",
help: "Compares the popularity of two terms using Websource.It Example: try 'websource google and yahoo'",
takes: {"first": noun_arb_text},
modifiers: {and: noun_arb_text},