使用 selenium 模拟浏览器请求

https://segmentfault.com/a/1190000004586828 https://github.com/emmetio/pyv8-binaries

http://selenium-python.readthedocs.io/installation.html http://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path

http://os.51cto.com/art/201407/446726.htm

http://stackoverflow.com/a/24364290/2544762

[精]https://christopher.su/2015/selenium-chromedriver-ubuntu/ [所有版本chrome]https://google-chrome.en.uptodown.com/ubuntu/old [chrome 46]http://www.ubuntumaniac.com/2015/10/install-google-chrome-46-on-ubuntu-1510.html


太扯蛋了,搞了足足半天,还是直接拿 docker 镜像整洁完美搞定,上面的!!!全都不行!!!

https://hub.docker.com/r/selenium/standalone-chrome/

然后参照文档:

http://selenium-python.readthedocs.io/installation.html

那下面举个例子,有空再来整理了:

import re
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys

driver = webdriver.Remote(
    command_executor='http://45.32.36.100:32768/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME)
driver.get('https://m.kuaidi100.com/index_all.html?postid=035562714823')

body = driver.page_source
express_company = re.findall('smart-result-comname">([^<]+)</span', body)
print(express_company)
driver.quit()


【转载请附】愿以此功德,回向 >>

原文链接:https://www.huangwenchao.com.cn/2016/12/selinium.html【使用 selenium 模拟浏览器请求】

发表评论

电子邮件地址不会被公开。 必填项已用*标注