arm树莓派Raspbian 下安装selenium+chrome
arm树莓派Raspbian 下安装selenium+chrome
安装selenium
pip3 install selenium
安装chromedriver
sudo apt-get install chromium-chromedriver
查看安装路径
dpkg -L chromium-chromedriver
3 import time
4 from datetime import datetime
5
6 from selenium import webdriver
7 from selenium.webdriver.chrome.options import Options
8
9 #from dbfs.dalog import log_print as print
10
11
12 class WebDriver(object):
- 13 def __init__(self):
- 14 self._options = Options()
2 15 self._options.add_argument('--headless')
| 16
| 17
| 18 def get_web(self, url):
- 19 content = ''
2 20 st = datetime.now()
2 21 with webdriver.Chrome(chrome_options=self._options) as driver:
2 22 print(">>>>> WebDriverChrom {} GET: {}\r\n".format(st, url))
2 23 driver.get(url)
2 24 time.sleep(10)
2 25 content = driver.page_source
2 26 et = datetime.now()
2 27 print("<<<<< {} UseTime: {}\r\n <<< RECV {}".format(et, (et-st).total_seconds(), True))
2 28 #print(content, driver.current_url)
2 29 return dict(status=True, content=content, url=driver.current_url)
30
31
32 webget = WebDriver().get_web
33
34
35 __all__ = ['webget']
36
37
38 if __name__ == '__main__':
- 39 url = 'https://kuaibao.qq.com/s/20181224A0R6M300?refer=kb_news&omgid=1e32392c176538c757f9132b230e79a2&chlid=5915889&atype=0'
| 40 webget(url)
Chromium
确保你已经安装了 chromium。
chromium 安装之后的目录可以使用 ls /usr/lib/chromium-browser 查看。
使用 sudo apt search chromedriver 可以惊喜地发现在 APT 中就可以安装 chromium 驱动。
使用 sudo apt install -y chromium-chromedriver 即可安装.
使用方式:
$ python3
...msg...
>>> from selenium import webdriver
>>> browser = webdriver.Chrome(
... executable_path='/usr/lib/chromium-browser/chromedriver')
>>> browser.get('baidu.com')
>>> browser.quit()
>>>
>>> exit()
arm树莓派Raspbian 下安装selenium+chrome的更多相关文章
- arm 环境下安装selenium+chrome
1. 升级软件 apt-get update 2. 安装pip apt-get install python3-pip 3. 安装selenium pip3 install selenium .4. ...
- 在树莓派Raspbian下安装支持Hard Float的.NET环境
[题外话] 最近入了个树莓派玩,系统装的官方推荐的Hard Float的Raspbian,由于衍生自Debian,所以Mono什么的非常好装.但是官方源中的Mono在Hard Float的Raspbi ...
- Ubuntu 14.04 LTS下安装Google Chrome浏览器
在Ubuntu 14.04下安装Google Chrome浏览器非常简单,只要到Chrome的网站下载Deb安装包并进行安装即可.当然你也可以使用APT软件包管理器来安装Google Chrome浏览 ...
- Windows下安装Selenium
安装python,建议在官网下载python3以上的版本 安装easy_install,找度娘 安装selenium,在命令行窗口下输入:pip install -U selenium 下载chrom ...
- linux安装selenium+chrome+phantomjs
1. 安装 selenium pip3 install selenium pip3 安装参考 2. 安装 ChromeDriver yum install chromedriver.x86_64 3. ...
- 环境部署(九):linux下安装python+chrome+Xvfb
在基于selenium进行的UI自动化测试中,开发调试环境一般都是windows操作系统.完成后需要部署到专门的测试环境. 如要要部署到linux环境的服务器(阿里云.腾讯云)执行,那么测试脚本也需要 ...
- linux环境下安装selenium+chrom+chromdriver.exe
原文:https://blog.csdn.net/yoyocat915/article/details/80580066 原文:https://blog.csdn.net/hanxue6898/art ...
- windows环境下安装selenium+python
selenium 是一个web的自动化测试工具,不少学习功能自动化的同学开始首选selenium ,相因为它相比QTP有诸多有点: * 免费,也不用再为破解QTP而大伤脑筋 * 小巧,对于不同的语 ...
- linux无界面模式安装selenium+chrome+chromedriver并成功完成脚本(亲测可用)
环境:docker centos 7.4 能通外网 写好的selenium脚本. 具体步骤: 一:安装selenium 这是最简单的 直接利用 pip3 install selenium 二 安装c ...
随机推荐
- log4j和slf4j的区别
之前在项目中用的日志记录器都是log4j的日志记录器,可是到了公司发现项目要求使用slf4j,于是想着研究一下slf4j的用法. 注意:每次引入Logger的时候注意引入的jar包,因为有Logger ...
- 洛谷 P1167 刷题
洛谷 P1167 刷题 洛谷传送门 题目描述 noip临近了,小A却发现他已经不会写题了.好在现在离竞赛还有一段时间,小A决定从现在开始夜以继日地刷题.也就是说小A废寝忘食,一天二十四小时地刷题. 今 ...
- 28 让树莓派开机“说”出自己的IP地址
http://shumeipai.nxez.com/2019/02/02/analogue-audio-redux.html 树莓派音频口底噪消除的方法
- 用纯真ip数据库.dat文件查询ip归属
网址:http://www.cz88.net/ 下载安装后,有这个文件: 安装路径/ip/qqwry.dat 创建实例的时候吧这个文件路径传入,即可调用. /** * 从纯真IP地址库查询ip归属 * ...
- 使用plv8+ shortid npm包构建一个短唯一id服务
plv8 是一个很强大的pg 扩展插件,我们可以直接额使用js 增强sql ,shortid 是一个用来生成短连接id 很方便的类库 因为shortid 是一个npm 模块,我们需要使用一种方法使用r ...
- Android 开发基础入门篇: android studio安装教程
下载地址 http://www.android-studio.org/ 注意: 安装主要分两种情况,下载的自带SDK和不带SDK两种 然后又分为安装版,就是.exe和解压版 两种的区别...解压版,, ...
- [no_perms] Private mode enable, only admin can publish this module
在使用npm publish是出现了错误: npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npm.taobao.or ...
- ros ap 的无线中继
https://wiki.mikrotik.com/wiki/Manual:Interface/Wireless#Repeater Wireless repeater will allow to re ...
- express框架,使用 static 访问 public 内静态文件
使用 express 生成 node 服务器后,我们需要访问放在public文件夹内的静态文件,如上传的图片 我们需要在app.js中添加配置项: app.use('/public',express. ...
- linux免费https证书申请教程
linux免费https证书申请教程直接去阿里云 菜单有个证书服务进去有个购买证书菜单 选择免费的 然后会提示写个人资料 然后系统生成csr 然后提交审核这个时候会有份邮件 文件下载上传到你的服务器 ...