一.具体代码实现

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. 摊铺机基本参数介绍(三一重工SSP220C-5)

    三一重工SSP220C-5稳定土摊铺机参数 SSP系列稳定土摊铺机SSP220C-5 动力强劲162kw 动力充分满足摊铺机各种工况下动力需求 高效任何工况,确保摊铺能力大于900t/h,行业内绝无仅 ...

  2. 前端常用js脚本

    常用js整理 //获取Url中的参数值 function getQueryString(name) { var reg = new RegExp("(^|&)" + nam ...

  3. springmvc 学习笔记1

    1.新建JAVAWEB程序,并导入jar包到工程.(IOC,SPRING MVC两部分) a.复制JAR包到lib文件夹下. b.选上所有jar包,右键后选"Bulid Path" ...

  4. oracle 字典表查询

    1.oracle 字典表查询 /*显示当前用户*/ show user 在sql plus中可用,在pl sql中不可用 /*查看所有用户名*/ select username,user_id,cre ...

  5. SBT搭建Spark

    http://www.cnblogs.com/yongjian/p/6211007.html http://www.aboutyun.com/thread-8587-1-1.html http://b ...

  6. QT 使用QTcpServer QTcpSocket 建立TCP服务器端 和 客户端

    1.  如图客户端连接server后,server发送"hello tcp" 给客户端 2. 实例代码 -----------------------------------  s ...

  7. Vue 什么是组件

    Vue.js组件 组件的作用:组件是自定义元素,可扩展html元素,封装可复用的代码. 组件的注册一定要在初始化根实例之前,负责组件是不起作用的. 全局组件在初始化实例的时候被使用 局部组件仅在实例/ ...

  8. 0.00-050613_ZC_Chapter4_20160119

    1. 4.9.2 引导启动程序 boot.s “...,这个引导扇区程序仅能够加载长度不好过16个扇区的head代码,...” ZC: 一个扇区的大小是多大? 搜索得到: 1.1. http://zh ...

  9. Spring Boot入门——tomcat配置

    1.通过配置文件配置 server.port = 8080 2.通过程序配置 import org.springframework.boot.SpringApplication; import org ...

  10. [Kafka] - Kafka内核理解:消息存储机制

    一个Topic分为多个Partition来进行数据管理,一个Partition中的数据是有序.不可变的,使用偏移量(offset)唯一标识一条数据,是一个long类型的数据 Partition接收到p ...