Skip to content

Instantly share code, notes, and snippets.

@jarib
Created April 9, 2013 13:47
Show Gist options
  • Save jarib/5345800 to your computer and use it in GitHub Desktop.
Save jarib/5345800 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
frame_html = <<-HTML
<a id="submit" href="#" onclick="window.top.location = 'http://www.google.no/'; return false;">Continue</a>
HTML
page = <<-HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<iframe id="search" src="data:text/html;content-type=utf-8,#{URI.escape frame_html}"></iframe>
</body>
</html>
HTML
driver.get "data:text/html;content-type=utf-8,#{URI.escape page}"
driver.switch_to.frame(0)
driver.find_element(id: 'submit').click
puts "ok"
driver.quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment