from selenium import webdriver
drive = webdriver.phantomjs(executable_path='D:\python\scrapy\phantomjs-2.1.1-windows\bin\phantomjs.exe')
url='https://google.com'
drive.get(url)
当我运行这个python程序时:
drive = webdriver.phantomjs(executable_path='D:\python\scrapy\phantomjs-2.1.1-windows\bin\phantomjs.exe')
错误:
TypeError: 'module' object is not callable
答案 0 :(得分:0)
通过调用 webdriver.PhantomJS()
,可以创建 PhantomJS / Ghostdriver 的新实例。因此,您需要将代码更改为:
from selenium import webdriver
drive = webdriver.PhantomJS(executable_path=r'D:\python\scrapy\phantomjs-2.1.1-windows\bin\phantomjs.exe')
url='https://google.com'
drive.get(url)