我希望从动态网站中提取一些信息。
from selenium import webdriver
import time
driver = webdriver.PhantomJS(executable_path='/Users/xxx/anaconda/phantomjs-2.0.0-macosx/bin/phantomjs')
driver.get("http://pythonscraping.com/pages/javascript/ajaxDemo.html")
time.sleep(3)
print(driver.find_element_by_id("content").text)
driver.close()
当我运行上面的代码时,我收到以下错误消息:
"selenium.common.exceptions.WebDriverException: Message:
Can not connect to GhostDriver on port 61121"
任何想法为什么?