# Run `python -m SimpleHTTPServer` and `python iframe-error.py` in same folder # Tested with PhantomJS 2.0.1-regression-12506 from https://github.com/skakri/phantomjs/releases/tag/2.0.1-regression-12506 # on OSX 10.11.2 from selenium import webdriver driver = webdriver.PhantomJS(service_args=['--debug=true']) driver.get("http://localhost:8000/phantomjs.html") driver.find_element_by_css_selector("#open-iframe").click() driver.switch_to_frame("demo-iframe") driver.find_element_by_css_selector("#close-iframe").click() driver.switch_to.default_content() # Crash