一.具体代码实现

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
import time driver = webdriver.Ie()
driver.maximize_window() #浏览器窗口最大化
driver.get("https://www.baidu.com/") driver.implicitly_wait(10) setting = driver.find_element_by_link_text("设置")
ActionChains(driver).move_to_element(setting).perform() driver.find_element_by_link_text("搜索设置").click()
driver.implicitly_wait(10) selector = driver.find_element_by_name("NR")
Select(selector).select_by_index(2)
time.sleep(3)
driver.find_element_by_xpath('//*[@id="gxszButton"]/a[1]').click()
time.sleep(3)
driver.switch_to.alert.accept() driver.find_element_by_id("kw").send_keys("python")
driver.find_element_by_id("su").click()

  

11.Selenium+Python案例--百度的更多相关文章

  1. 18.Selenium+Python案例 -- 豆瓣

    一.具体代码实现: from selenium import webdriver driver = webdriver.Firefox() driver.get('https://www.douban ...

  2. 12.Selenium+Python案例 -- 今日头条(获取科技栏目的所有新闻标题)

    一:具体代码实现 # -*- coding: utf-8 -*-# @Time : 2018/7/26 16:33# @Author : Nancy# @Email : NancyWangDL@163 ...

  3. selenium+python自动化测试

    F12: 右键   选择复制  path 在selenium+python自动化测试(一)–环境搭建中,运行了一个测试脚本,脚本内容如下: from selenium import webdriver ...

  4. selenium python 一些操作和定位收集

    (—)滚动条操作 python中selenium操作下拉滚动条方法汇总 selenium_webdriver(python)控制浏览器滚动条 selenium+Python(select定位) Sel ...

  5. Selenium+Python:下载文件(Firefox 和 Chrome)

    引自  https://blog.csdn.net/Momorrine/article/details/79794146 1.      环境 操作系统 Win10 IDE Eclipse (Oxyg ...

  6. selenium+python在mac环境上的搭建

    前言 mac自带了python2.7的环境,所以在mac上安装selenium环境是非常简单的,输入2个指令就能安装好 需要安装的软件: 1.pip 2.selenium2.53.6 3.Firefo ...

  7. selenium + python自动化测试环境搭建

    selenium的在python平台的搭建: 搭建平台windows 准备工具如下: --------------------------------------------------------- ...

  8. Page Object Model (Selenium, Python)

    时间 2015-06-15 00:11:56  Qxf2 blog 原文  http://qxf2.com/blog/page-object-model-selenium-python/ 主题 Sel ...

  9. selenium + python 多浏览器测试

    selenium + python 多浏览器测试 支持库包 在学习 Python + Selenium 正篇之前,先来看下对多浏览器模拟的支持.目前selenium包中已包含webdriver,hel ...

随机推荐

  1. Linux网络检测手段汇总

    1.iftop iftop可测量通过每一个套接字连接传输的数据:它采用的工作方式有别于nload.iftop使用pcap库来捕获进出网络适配器的数据包,然后汇总数据包大小和数量,搞清楚总的带宽使用情况 ...

  2. 优美的英文诗歌Beautiful English Poetry

    <When you are old>——<当你老了> --- William Butler Yeats ——威廉·巴特勒·叶芝When you are old and grey ...

  3. 手把手教你使用eclipse+qemu+gdb来单步调试ARM内核【学习笔记】

    平台信息:linux4.0 平台:qemu 作者:庄泽彬 说明:笨叔叔的Linux视频的笔记 一.编译linux源码 export CROSS_COMPILE=arm-linux-gnueabi- e ...

  4. Centos7.4 Nginx反向代理+负载均衡配置

    Ningx是一款高性能的HTTP和反向代理服务器,配置起来也比较简单. 测试环境: 172.16.65.190 Nginx-反向代理 172.16.65.191 Ningx-Web 172.16.65 ...

  5. POI技术实现对excel的导出

    需求:客户端传来两个参数,当前页码和每页的条数,根据传来的参数实现对数据的导出 1.导入依赖 <!-- 报表相关 --> <dependency> <groupId> ...

  6. Lucene简单介绍

    [2016.6.11]以前写的笔记,拿出来放到博客里面~ 相关软件: Solr, IK Analyzer, Luke, Nutch;Tomcat; 1.是什么: Lucene是apache软件基金会j ...

  7. 【bzoj2151】种树(堆/优先队列+双向链表)

    题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2151 这道题因为优先队列不怎么会用,而且手写堆的代码也不长,也想复习一下手写堆的写法…… ...

  8. 关于series的统计

    1.统计se中各个元素出现的次数: se.value_counts() 这个命令就非常重要!(df没有这个命令) 另外series转dict是to_dict(),注意与数组转list的tolist() ...

  9. selenium+python3 鼠标事件

    1.鼠标右击 ActionChains(driver).contest_click(right_click).perform() 2.鼠标悬停 ActionChains(driver).move_to ...

  10. Springboot- Caused by: org.hibernate.AnnotationException: No identifier specified for entity:

    错误与异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 原因:引用了不对的包, ...