11.Selenium+Python案例--百度
一.具体代码实现
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案例--百度的更多相关文章
- 18.Selenium+Python案例 -- 豆瓣
一.具体代码实现: from selenium import webdriver driver = webdriver.Firefox() driver.get('https://www.douban ...
- 12.Selenium+Python案例 -- 今日头条(获取科技栏目的所有新闻标题)
一:具体代码实现 # -*- coding: utf-8 -*-# @Time : 2018/7/26 16:33# @Author : Nancy# @Email : NancyWangDL@163 ...
- selenium+python自动化测试
F12: 右键 选择复制 path 在selenium+python自动化测试(一)–环境搭建中,运行了一个测试脚本,脚本内容如下: from selenium import webdriver ...
- selenium python 一些操作和定位收集
(—)滚动条操作 python中selenium操作下拉滚动条方法汇总 selenium_webdriver(python)控制浏览器滚动条 selenium+Python(select定位) Sel ...
- Selenium+Python:下载文件(Firefox 和 Chrome)
引自 https://blog.csdn.net/Momorrine/article/details/79794146 1. 环境 操作系统 Win10 IDE Eclipse (Oxyg ...
- selenium+python在mac环境上的搭建
前言 mac自带了python2.7的环境,所以在mac上安装selenium环境是非常简单的,输入2个指令就能安装好 需要安装的软件: 1.pip 2.selenium2.53.6 3.Firefo ...
- selenium + python自动化测试环境搭建
selenium的在python平台的搭建: 搭建平台windows 准备工具如下: --------------------------------------------------------- ...
- Page Object Model (Selenium, Python)
时间 2015-06-15 00:11:56 Qxf2 blog 原文 http://qxf2.com/blog/page-object-model-selenium-python/ 主题 Sel ...
- selenium + python 多浏览器测试
selenium + python 多浏览器测试 支持库包 在学习 Python + Selenium 正篇之前,先来看下对多浏览器模拟的支持.目前selenium包中已包含webdriver,hel ...
随机推荐
- 【leetcode刷题笔记】Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...
- Sublime Text3 打开文档乱码
一.安装包管理器使用Ctrl+~快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码 import urllib.request,os; pf = 'Package C ...
- 初识Spring security-无Security的SpringMVC
百度百科定义: Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架.它提供了一组可以在Spring应用上下文中配置的Bean,充分利用了 ...
- js获取select标签选中的值[转]
var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 va ...
- windows DPAPI加密解密学习
#include "stdafx.h" #include <windows.h> #include <Wincrypt.h> #include <io ...
- SpringBoot中使用Spring Data Jpa 实现简单的动态查询的两种方法
软件152 尹以操 首先谢谢大佬的简书文章:http://www.jianshu.com/p/45ad65690e33# 这篇文章中讲的是spring中使用spring data jpa,使用了xml ...
- 不小心把服务器上的/usr/lib下的所有文件删除,恢复办法
手贱,使用root用户,rm -rf 多了一个"*"……导致了万分惊恐的悲剧,/usr/lib下的所有文件被删除…… 修复办法: linux系统是基于文件的,所以只要能拷贝到和原来 ...
- 语音02_Delphi
网址 :http://www.exceletel.com/support/whtpapers/speech/delphi.htm Installing the Microsoft SAPI speec ...
- 【转】Pearson,Spearman,Kendall相关系数的具体分析
测量相关程度的相关系数很多,各种参数的计算方法及特点各异. 连续变量的相关指标: 此时一般用积差相关系数,又称pearson相关系数来表示其相关性的大小,积差相关系数只适用于两变量呈线性相关时.其数值 ...
- jsp: jstl标签库 uri标签
与 URL 相关的标签主要是用来将其他文件包含进来,或者提供页面之间的重定位以及 URL 地址的生成.参数的输出等等.一般包括如下几个标签<c:import>标签:与传统 JSP 页面中的 ...