phantomjs渲染网页

2021-06-06 01:03

阅读:553

dcap["phantomjs.page.settings.userAgent"] = (random.choice(agents))
dcap["phantomjs.page.settings.loadImages"] = False
#dcap["phantomjs.page.settings.disk-cache"] = True
dcap["phantomjs.page.customHeaders.Cookie"] =‘xxxxxxxxxx‘

#driver = webdriver.PhantomJS(executable_path=‘C:\\Python27\\phantomjs.exe‘, service_args=[‘--load-images=no‘],desired_capabilities=dcap) #或者把phantomjs放在任何一个是环境变量文件夹的里面。
driver = webdriver.PhantomJS(executable_path=‘/home/yangdefeng/Downloads/phantomjs-2.1.1-linux-x86_64/bin/phantomjs‘,service_args=[‘--load-images=no‘],desired_capabilities=dcap) #linux版本的需要修改phantomjs文件的权限,chmod u+x phantomjs,否则报错peimission delined


评论


亲,登录后才可以留言!