使用phantomjs selenium美发设置来打印页面源代码,但在https上只返回空白的html。返回http上的页面源代码。阅读大量资料,例如this和this,但没有结果。
from selenium import webdriver
import urllib.request as urllib2
import requests
import urllibh
from bs4 import BeautifulSoup
import csv
import time
browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
browser.get('https://google.com')
browser.set_window_size(2000, 1500)
soup = BeautifulSoup(browser.page_source, "html.parser")
print(soup)
browser.quit()结果
<html><head></head><body></body></html>
Complete发布于 2017-07-17 19:58:38
browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true', '--ssl-client-certificate-file=C:\tmp\clientcert.cer', '--ssl-client-key-file=C:\tmp\clientcert.key', '--ssl-client-key-passphrase=1111'])必须将SSL证书指向本地文件。
https://stackoverflow.com/questions/45091020
复制相似问题