Skip to content

Instantly share code, notes, and snippets.

require "benchmark"
require "rmagick"
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'win32/screenshot'
t = "Internet Explorer"
Benchmark.bmbm do |x|
x.report("no file") {50.times {Win32::Screenshot.window(t, 0) {}}}
x.report("bmp") do
require "benchmark"
require 'win32/screenshot'
t = "Internet Explorer"
Benchmark.bmbm do |x|
x.report("no file") {50.times {|i| Win32::Screenshot.window(t, 0) {|w, h, b| File.open("pic#{i}.bmp", "wb") {|f| f.puts b}}}}
end
class Object
def descendant?(parent)
parent = parent.class unless parent.is_a?(Class) || parent.is_a?(Module)
self.class.to_s.index("#{parent}::") == 0
end
end
module MyModule
module AnotherModule
class MyClass
diff --git a/common/src/js/bot/dom.js b/common/src/js/bot/dom.js
index 0ec37dd..600e136 100644
--- a/common/src/js/bot/dom.js
+++ b/common/src/js/bot/dom.js
@@ -365,7 +365,7 @@ bot.dom.getVisibleText = function(node) {
if (nodeText.length) {
if (bot.dom.isClosestAncestorBlockLevel_(elements, i)) {
returnValue += '\n';
- } else if (i != 0) { // First element does not need preceding space.
+ } else if (i != 0 && !nodeText[0].match(/[,.:;?!%]/)) { // First element and some symbols do not need preceding space.
function testGetVisibleTextShouldNotRemoveIntentedSpaces() {
var text = getVisibleTextByElementId("shakespeare");
assertEquals("To be, or not to be: that is the question.", text);
}
<span><strong id="shakespeare">To be, or not to be:&nbsp;&nbsp;that is the question.</strong></span>
WatirSpec guards for this implementation:
not_compliant : {:file=>"./spec/watirspec/browser_spec.rb:207"}
deviates : {:file=>"./spec/watirspec/browser_spec.rb:216"}
bug : {:file=>"./spec/browser_spec.rb:32", :key=>"http://github.com/jarib/watirspec/issues/issue/8"}
bug : {:file=>"./spec/watirspec/browser_spec.rb:84", :key=>"http://github.com/jarib/watirspec/issues/issue/8"}
not_compliant : {:file=>"./spec/watirspec/browser_spec.rb:52"}
not_compliant : {:file=>"./spec/watirspec/div_spec.rb:178"}
bug : {:file=>"./spec/watirspec/frames_spec.rb:4", :key=>"http://github.com/jarib/watir-webdriver/issues#issue/17"}
bug : {:file=>"./spec/watirspec/frame_spec.rb:48", :key=>"http://github.com/jarib/watir-webdriver/issues#issue/17"}
not_compliant : {:file=>"./spec/watirspec/image_spec.rb:127"}
windows 7, 64bit
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]
(in C:/Users/jarmo/Desktop/minu/projects/Ruby/childprocess)
All dependencies seem to be installed.
FFFFFF
C:\Users\jarmo\Desktop\minu\projects\Ruby\selenium-read-only>go //rb:firefox-test:mri
(in C:/Users/jarmo/Desktop/minu/projects/Ruby/selenium-read-only)
'pkg-config' is not recognized as an internal or external command,
operable program or batch file.
No Gecko sdk detected. Install xulrunner-dev to compile 64-bit Firefox extension.No srcs specified for selenium-core
Preparing: //rb:common in build/rb
Preparing: //rb:remote in build/rb
Compiling: //firefox:atoms as build\firefox\atoms.js
Compiling: //firefox:utils as build\firefox\utils.js
Preparing: //firefox:webdriver as build/firefox/webdriver.xpi
module A
def a
self.class.const_get :CONST
end
end
class B
include A
CONST = "Hello"
describe "something" do
# ...
it "works like something" do
@browser.text_field(:id => "something").set "text"
@browser.checkbox(:id => "works").clear
@browser.button(:id => "like").click
@browser.div(:id => "error").should be_visible
end
# ...
end