启动Chrom浏览器

下载chromedriver:

http://chromedriver.storage.googleapis.com/index.html

当时找chromedriver与chrome的的对应版本的好麻烦,如今整理下:

驱动的下载地址如下:
http://chromedriver.storage.googleapis.com/index.html

我下载的是2.29,对应的Chrome浏览器下载的下图中绿色标记的那个,下载完后将exe文件放在“C:\Users\Administrator\AppData\Local\Google\Chrome\Application”路径下,即Chrome快捷方式的路径下

然后将上面的路径添加到path中

下载浏览器:https://www.chromedownloads.net/chrome32win-stable/

以上设置完毕后PyCharm运行时还是报莫名其妙的错误,这时重启PyCharm,OK了

以下是模拟登录京东商城签到的,可惜点登录时要输入图形验证码,卡在这里、、、

 import time

 from selenium import webdriver
import os username = "jiangpr_ok@163.com" # 请替换成你的用户名
password = "d123456789d" # 请替换成你的密码 driver = webdriver.Chrome() # 选择Chrome浏览器
# driver = webdriver.Firefox()
driver.get(url='http://vip.jd.com') # 打开京东会员网站
time.sleep(1) driver.find_element_by_link_text('账户登录').click()
driver.find_element_by_id('loginname').click()
driver.find_element_by_id('loginname').send_keys(username)
driver.find_element_by_id('nloginpwd').click()
driver.find_element_by_id('nloginpwd').send_keys(password) driver.find_element_by_id('loginsubmit').click()
time.sleep(1)
driver.find_element_by_id('signIn').click()
driver.close()

selenium python 启动Chrome的更多相关文章

  1. selenium webdriver启动Chrome浏览器后无法输入网址的解决办法

    通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...

  2. selenium 定制启动chrome的参数

    selenium 定制启动chrome的参数 设置代理. 禁止图片加载 修改ua https://blog.csdn.net/vinson0526/article/details/51850929 1 ...

  3. Selenium+Python调Chrome浏览器时报Traceback (most recent call last): File "C:/Users/EDZ/Desktop/selenium_demo/demo001.py", line 12, in <module>

    上次使用Selenium+Python还是好几个月前了 今天想再用一下,结果写个打开网站的小demo报错,报错如下: 检查了一下,查看报错日志,应该是chrome版本和driver版本不一致导致的. ...

  4. Python学习笔记之selenium 定制启动 chrome 的选项

    在自动化中,默认情况下我们打开的就是一个普通的纯净的chrome浏览器,而我们平时在使用浏览器时,经常就添加一些插件,扩展,代理之类的应用.所以使用 selenium 时,我们可能需要对 chrome ...

  5. python selenium 定制启动Chrome的选项注意事项(十九)

    自动化测试的时候为了避免每个case均需要登录的操作,所以把登录后的cookie信息保存下来,在有效期内使用cookie的方式实现登录操作,为了避免展现太多的登录操作,需要通过设置浏览器的option ...

  6. selenium 定制启动 chrome 的选项

    序 使用 selenium 时,我们可能需要对 chrome 做一些特殊的设置,以完成我们期望的浏览器行为,比如阻止图片加载,阻止JavaScript执行 等动作.这些需要 selenium的 Chr ...

  7. selenium+python启动浏览器出错,安装浏览器驱动

    WebDriver 支持 Firefox (FirefoxDriver).IE (InternetExplorerDriver).Opera (OperaDriver) 和 Chrome (Chrom ...

  8. selenium+python启动Firefox浏览器失败问题和点击登陆按钮无效问题

    问题1:使用python+selenium编写脚本调用Firefox时报错:

  9. selenium python 启动Firefox

    我的火狐浏览器版本是最新的: 下载geckodrive:https://github.com/mozilla/geckodriver/releases/ 下载完后将exe文件放到这里“D:\firef ...

随机推荐

  1. 【Python3】 django2.0 url 跳转设置

    python: 3.6.4 django :  2.0 在创建应用时候.我是把 urls.py 分开了.所以在设置url跳转时候.要修改成如下模式 1  父 urls.py 里边要加上命名空间 2   ...

  2. css笔记 - 张鑫旭css课程笔记之 relative 篇

    relative地址 relative 对 absolute的限制作用 限制left/top/right/bottom(方位值)定位 限制描述:absolute设置了方位值时,这些方位值是相对于pos ...

  3. 告知你不为人知的UDP-疑难杂症和使用

    版权声明:本文由黄日成原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/848077001486437077 来源:腾云阁 h ...

  4. 转载>>六款大数据采集平台的架构分析

    随着大数据越来越被重视,数据采集的挑战变的尤为突出.今天为大家介绍几款数据采集平台: Apache Flume Fluentd Logstash Chukwa Scribe Splunk Forwar ...

  5. 推荐一款不错的TP5开源是CMS

    这是最近在使用的一套CMS,拟进行二次开发作为企业CMS来使用. http://www.cltphp.com/index.html git地址: https://gitee.com/chichu/cl ...

  6. 9.6Django

    2018-9-6 12:56:32 2018-9-6 18:32:22 把那个用户列表的页面优化了一下!用了老师更好看的页面,但是功能还是那些! 就是修改一下url就好! 放在我我的github  : ...

  7. CvArr* to cv::Mat 转换

    OpenCV中的CvArr*的定义的一个空类型的指针,可以转换为其派生类CvMat和IplImage,那么如何将其转化为cv::Mat呢,其实很简单,只需要一行代码即可: // CvArr *_img ...

  8. Bazel构建工具的安装

    官方Doc:https://docs.bazel.build/versions/master/install-ubuntu.html 使用Bazel定制的APT存储库 (recommended) 1. ...

  9. HDU 3507 - Print Article - [斜率DP]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3507 Zero has an old printer that doesn't work well s ...

  10. 去除Layer自带隐藏动画

    在TableView的HeadView设置的时候(HeadView是刚刚创建和设置的),会出现很多不想看到的动画,此时可以增加代码去除这些动画 [CATransaction begin]; [CATr ...