selenium python 启动Firefox
我的火狐浏览器版本是最新的:

下载geckodrive:https://github.com/mozilla/geckodriver/releases/

下载完后将exe文件放到这里“D:\firefox”即firefox安装目录的快捷方式所在的文件夹,同时将这个路径放到path中:
D:\Python3\Scripts\;D:\Python3\;D:\Python36-32\Scripts\;D:\Python36-32\;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\OpenVPN\bin;c:\windows\system32;E:\Python;D:\Python36-32;D:\Python3;E:\python\python3;C:\Users\Administrator\AppData\Local\Google\Chrome\Application;D:\firefox
重启下PyCharm可以调用了:
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()
selenium python 启动Firefox的更多相关文章
- selenium+python启动Firefox浏览器失败问题和点击登陆按钮无效问题
问题1:使用python+selenium编写脚本调用Firefox时报错:
- selenium+python启动浏览器出错,安装浏览器驱动
WebDriver 支持 Firefox (FirefoxDriver).IE (InternetExplorerDriver).Opera (OperaDriver) 和 Chrome (Chrom ...
- selenium python 启动Chrome
启动Chrom浏览器 下载chromedriver: http://chromedriver.storage.googleapis.com/index.html 当时找chromedriver与chr ...
- Behave + Selenium(Python) 二
介绍feature, py文件和之间关系: example01.feature文件包括5行: Feature行: 介绍这个feature用来干什么的: Scenario行:介绍这个scenario用来 ...
- 7.解决在python中用selenium启动FireFox浏览器启动不了的方法
首次在利用python中的selenium启动FireFox浏览器时可能碰到如下问题 当输入如下代码时: from selenium import webdriver brower=webdriver ...
- Selenium启动Firefox示例(python版)
目前做selenium自动化使用的主流语言分为java和python,前一篇为java版,本篇介绍python实现selenium启动Firefox. 1 #-*- coding:utf-8 -*- ...
- Selenium+Python浏览器调用:Firefox
如何查看python selenium的API python -m pydoc -p 4567 说明: python -m pydoc表示打开pydoc模块,pydoc是查看python文档的首选工 ...
- selenium webdriver 启动三大浏览器Firefox,Chrome,IE
selenium webdriver 启动三大浏览器Firefox,Chrome,IE 1.安装selenium 在联网的情况下,在Windows命令行(cmd)输入pip install selen ...
- Python启动浏览器Firefox\Chrome\IE
# -*- coding:utf-8 -*- import os import selenium from selenium import webdriver from selenium.webdri ...
随机推荐
- css3整理--gradient
gradient语法: -moz-linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, & ...
- jQuery事件处理(六)
1.通过一步步调试的的方法观察了一下存放到cache中的事件及其处理程序的数据格式: { events : { // 根据事件类型存放添加到该元素上的所有事件,下面以click为例 click : [ ...
- C# 程序自动重启的解决方法
很多时候,我们有这样的场景,需要让程序自动重启,有很多种方法,比如用微软自带提供的方法,或者自己开辟新的线程重新调用.下面简单介绍两种方法. 方法一. 使用方法Application.Restart( ...
- 如何区分一个系统是redhat centos ubuntu fedora debian中的哪一种
一.问题概述 有时候拿到一个环境,我们并不清楚是什么系统,是redhat啊,还是centos呢,是centos 6呢,还是centos 7呢. 这里参考了一篇博文: https://www.cnblo ...
- 【NOI2015】荷马史诗[Huffman树+贪心]
#130. [NOI2015]荷马史诗 统计 描述 提交 自定义测试 追逐影子的人,自己就是影子. ——荷马 Allison 最近迷上了文学.她喜欢在一个慵懒的午后,细细地品上一杯卡布奇诺,静静地阅读 ...
- Unity3D Animator控制参数和添加事件
Animator控制参数和添加事件 using UnityEngine; using System.Collections; public class AniControl : MonoBehavio ...
- SharePoint 2013部署自定义HttpModule访问SPContext.Current的一个问题
如果文档库post提交文档时,自定义HttpModule正好有代码访问SPContext.Current属性则会导致上传文档失败.
- Egret的屏幕适配模式图示
1 ShowAll 过长时,上边有边框 过短时,左右有边框 2 noScale 不会进行任何缩放 3 noBorder 过长时,裁减左右 过短时,裁减上下 4 fixedWidth 过长时,下方有边框 ...
- 【CF875F】Royal Questions 最小生成基环树森林
[CF875F]Royal Questions 题意:国王的n个王子该结婚了!现在从外国来了m位公主,第i位公主的嫁妆是wi.由于进步思想的传播,每个公主在选择配偶的事情上是有自主权的,具体地,每个公 ...
- 51单片机之IIC通信原理及软件仿真
关于IIC我觉这个博客里面说的已经够清楚了 如下图所示的写操作的时序图: 其实像这种通信协议的要求是很精确的,一点点不对都可能导致在实际工程中无法读取数据.我就是被一个应答位耽误了好久,还好最后被我发 ...