Using PhantomJS in webdriver, what are ways to improve navigation in sites
using JavaScript templates?
To start off with the simplest example, I have a Python script that uses
selenium/webdriver and includes Ghost Driver/PhantomJS() as it's
webdriver.
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get("http://shaneofalltrades.com")
driver.find_element_by_id("navbar-contact").click()
print driver.current_url
driver.quit
I opted to test in this site as it is using JavaScript templating to
create new pages and happens to do the funky stuff I get errors in when
scraping other similar sites. This is my site, so I can add anything to
help debug if any ideas. So far I can use this script on some other sites
and I can process the test on shaneofalltrades using Firefox...
driver = webdriver.Firefox()
Am I missing something about using a headless webdriver or is it always
going to be more difficult? Also, because it is "headless", I take it many
UI features are missing, so maybe I need specific selectors?
The reason I would rather use phantom.js over Firefox is the speed.
No comments:
Post a Comment