测试脚本是否支持在不同浏览器运行
firefox浏览器运行脚本

from selenium import webdriver

driver=webdriver.Firefox()

driver.get("http://baidu.com")
assert "sss" in driver.title
driver.quit()

chrome浏览器运行脚本

from selenium import webdriver
import os
chromedriver="C:\Program Files (x86)\Chrome\chromedriver.exe"
os.environ['webdriver.chrome.driver']=chromedriver
driver=webdriver.Chrome(chromedriver)
driver.get("http://baidu.com")
assert "sss" in driver.title
driver.quit()

python-selenium之firefox、Chrome、Ie运行的更多相关文章

  1. windows下安装配置python + selenium 来驱动firefox

    第一步,首先下载安装python ,我下载的是3.5版本,这个版本,自带了pip工具,不需要安装pip了 :) 链接地址:python 3.5 第二步,执行pip install selenium 安 ...

  2. Python启动浏览器Firefox\Chrome\IE

    # -*- coding:utf-8 -*- import os import selenium from selenium import webdriver from selenium.webdri ...

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

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

  4. python+selenium下载文件——Chrome

    from selenium import webdriver import time options = webdriver.ChromeOptions() prefs = { 'profile.de ...

  5. python+selenium webdriver.firefox()方式配置浏览器设置

    webdriver.firefox() 爬虫需求:  (其实是输入参数可获取.zip/pdf 文件,然后点击下载) ——但是firefox浏览器有Bug,点击下载之后会有弹出窗口,需要你点击确定,这怎 ...

  6. python+selenium浏览器调用(chrome、ie、firefox)

    代码: #coding=utf-8 from selenium import webdriver driver=webdriver.Chrome() #调用chrome浏览器 driver.get(' ...

  7. Docker环境下运行python+selenium+chrome

    Docker环境下运行python+selenium+chrome docker运行时占用的资源非常少,而且能将环境进行有效的隔离,可以快速的进行部署,因此可以将docker与selenium结合实现 ...

  8. selenium + firefox/chrome/phantomjs登陆之模拟点击

    登陆之模拟点击 工具:python/java + selenium + firefox/chrome/phantomjs (1)windows开发环境搭建 默认已经安装好了firefox 安装pip ...

  9. 在Centos7上安装Python+Selenium+Chrome+Chromedriver

    1.下载Chrome 上一篇文章已经演示过了Python+Selenium+Firefox+Geckodriver安装步骤并通过自动化脚本打开百度 因此当前只需要安装Chrome和Chromedriv ...

  10. Selenium启动Firefox示例(python版)

    目前做selenium自动化使用的主流语言分为java和python,前一篇为java版,本篇介绍python实现selenium启动Firefox. 1 #-*- coding:utf-8 -*- ...

随机推荐

  1. http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html(转载)(原作者:AstralWind)

      Python正则表达式指南   本文介绍了Python对于正则表达式的支持,包括正则表达式基础以及Python正则表达式标准库的完整介绍及使用示例.本文的内容不包括如何编写高效的正则表达式.如何优 ...

  2. RMAN 备份及策略

    更详细信息请转http://blog.chinaunix.net/uid-21187846-id-3017363.html 天,这里修改为15天:这样比较保险,到时候恢复时也可以找到当时的备份元数据: ...

  3. GestureDetectorl监听

    package com.example.gesturedetectorinterface; /** * write by harvic * 2014-9-25 * blog.csdn.net/harv ...

  4. robots笔记以免忘记

    html头部标签写法: <meta name="robots" content="index,follow" /> content中的值决定允许抓取 ...

  5. Microsoft Word 段前距设置和页眉设置

    在毕设论文整理中,段前距的设置和页眉的设置不起作用,这着实让我脑袋疼.网上搜索了几种方式,搭配一下还是起了作用. 一. 段前距设置 1. 各级标题在首页,段前距设置不起作用. 选择要段前分页的段落,右 ...

  6. CIB Training Scripts For TPC-H Benchmark

    http://52.11.56.155:7180/http://52.11.56.155:8888/ impala-shell -i 172.31.25.244 sudo -u hdfs hdfs d ...

  7. ie8 window.open导出文件报错

    js创建一个<a>元素hiddenElementhiddenElement.setAttribute('href','')hiddenElement.setAttribute('targe ...

  8. 例子:Bluetooth app to device sample

    本例子演示了: 判断蓝牙是否打开,是通过一个HRsult值为0x8007048F的异常来判断的 catch (Exception ex) { if ((uint)ex.HResult == 0x800 ...

  9. linux安装jdk(以centos安装jdk1.7为例)

    1准备工作: 1 虚拟机一台vmware12,安装64位centos 2 oracle官网下载jdk1.7-linux-x64.rpm 3 winscp将jdk传送到linux上面 2开始安装: 1 ...

  10. 在VBA中新建工作簿

    用程序计算数据,得到不同公司.不同项目的数据结果,最终还要将每个公司的数据结果放在各自的单独文件中.这就需要在vba中新建.保存excel文件.掌握几个东西就能很熟练了:1.要想保存在当前目录下,需要 ...