service_args = [
"--proxy-type=http",
"--proxy=218.91.112.196:9999",
"--ssl-protocol=any",
]
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = ("Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1")
driver = webdriver.PhantomJS(desired_capabilities=dcap,service_args=service_args)
driver.set_page_load_timeout(30)
try:
driver.get("http://test.com")
print(driver.page_source)
except:
pass
driver.quit()
service_args=service_args 加上这一个就返回
不加代理就能正常读取内容 试了几个代理都不行,Mayday Mayday !
Selenium 2.48 Phantomjs2.1.1 Python3.7 Windows10
1
leartang OP 有没有大神,求解答…
|