Created
June 5, 2013 23:59
-
-
Save bgnori/5718307 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PyYAML==3.10 | |
selenium==2.33.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Runner</title> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"> | |
</script> | |
<script> | |
</script> | |
</head> | |
<body><div id="output"></div></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from StringIO import StringIO | |
buf = StringIO() | |
from selenium import webdriver, selenium | |
driver = webdriver.PhantomJS('/usr/local/bin/phantomjs') | |
driver.get("file:///home/nori/Desktop/work/kn/js/hoge.html") | |
driver.execute_script(r'''$(document).ready(function(){ | |
$("#output").replaceWith("<div>webdriver!</div>") | |
});''') | |
print driver.current_url | |
print driver.title | |
print driver.page_source | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment