Skip to content

Instantly share code, notes, and snippets.

@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},
@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 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 );
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 / 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
@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 / 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 / Generic Highlight
Created July 16, 2013 14:37
Selenium WebDriver // Highlights the element object in a yellow border
driver.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", "border: 2px solid yellow; color: yellow; font-weight: bold;")
@bbbco
bbbco / $DEBUG.log
Created September 5, 2013 20:31
Since upgrading to Selenium WebDriver 2.35.1 I've been getting intermittent core dump when my tests complete. Here is the debug info I have gathered.
Finished in 2200.68985s
30 tests, 884 assertions, 0 failures, 1 errors, 1 skips
Writing XML reports to /cruisedata/jenkins-slave/workspace/SeleniumNewTests/selenium/rb/test/reports
I, [2013-09-05T14:50:08.677708 #1486] INFO : Killing browser
-> DELETE session/77fdaaf0-0631-4f10-851e-cbaed1098867
Exception `Errno::EAGAIN' at /home/site/.rvm/rubies/ruby-1.9.3-p448/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-p448/lib/ruby/1.9.1/net/protocol.rb:141 - Resource temporarily unavailable - read would block
<- {"name":"quit","sessionId":"77fdaaf0-0631-4f10-851e-cbaed1098867","status":0,"value":""}
#<ChildProcess::Unix::ForkExecProcess:0x0000000430e518 @args=["/usr/bin/firefox", "-no-remote", "-foreground"], @started=true, @exit_code=nil, @io=#<ChildProcess::Unix::IO:0x0000000430e4a0 @stdout=#<IO:<STDOUT>>, @stderr=#<IO:<STDERR>>>, @cwd=nil, @detach=false, @duplex=false, @environment={}, @pid=2844> : ["polling 5
@bbbco
bbbco / rpdb.py
Created November 20, 2013 17:53
Robot Framework Python Debugger based on Daniel Cohn's recipe at http://code.activestate.com/recipes/578073-rpdb-robotpythondebugger-a-smarter-way-to-debug-ro/ fixed and updated for Python 2.7 / Robot Framework 2.8.x by Brian Goad. Allows you to jump into the code and debug your custom Python keywords. Wraps pdb because Robot Framework steals th…
import pdb
import sys
IO = lambda s: (s.__stdin__, s.__stdout__)
def rpdb(F):
"""
Robot Framework Python Debugger based on Daniel Cohn's recipe at
http://code.activestate.com/recipes/578073-rpdb-robotpythondebugger-a-smarter-way-to-debug-ro/