Skip to content

Instantly share code, notes, and snippets.

@jarib
Created September 15, 2011 09:16
Show Gist options
  • Save jarib/1218879 to your computer and use it in GitHub Desktop.
Save jarib/1218879 to your computer and use it in GitHub Desktop.
SVG with watir-webdriver
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
begin
browser.goto "data:text/html;content-type=utf-8,#{URI.escape DATA.read}"
rect = browser.element(:tag_name => "rect")
p :x => rect.attribute_value(:x), :y => rect.attribute_value(:y)
ensure
browser.close
end
__END__
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>
</body>
</html>
@p0deje
Copy link

p0deje commented Dec 2, 2012

Why don't we support SVG in Watir-WebDriver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment