WebDriver API——第4部分Alerts
The Alert implementation.
- class selenium.webdriver.common.alert.Alert(driver)
-
Bases: object
Allows to work with alerts.
Use this class to interact with alert prompts. It contains methods for dismissing, accepting, inputting, and getting text from alert prompts.
Accepting / Dismissing alert prompts:
Alert(driver).accept()
Alert(driver).dismiss()Inputting a value into an alert prompt:
name_prompt = Alert(driver) name_prompt.send_keys(“Willian Shakesphere”) name_prompt.accept()Reading a the text of a prompt for verification:
alert_text = Alert(driver).text self.assertEqual(“Do you wish to quit?”, alert_text)- accept()
-
Accepts the alert available.
Usage:: Alert(driver).accept() # Confirm a alert dialog.
- dismiss()
-
Dismisses the alert available.
- send_keys(keysToSend)
-
Send Keys to the Alert.
Args: - keysToSend: The text to be sent to Alert.
- text
-
Gets the text of the Alert.
WebDriver API——第4部分Alerts的更多相关文章
- 转:python webdriver API 之操作测试对象
一般来说,所有有趣的操作与页面交互都将通过 WebElement 接口,包括上一节中介绍的对象定位,以及本节中需要介绍的常对象操作.webdriver 中比较常用的操作元素的方法有下面几个: cle ...
- Webdriver API (二)
(转载) 1.3 打开测试页面 对页面对测试,首先要打开被测试页面的地址(如:http://www.google.com),web driver 提供的get方法可以打开一个页面: // And no ...
- selenium2(WebDriver) API
selenium2(WebDriver) API 作者:Glen.He出处:http://www.cnblogs.com/puresoul/ 1.1 下载selenium2.0的包 官方downl ...
- Selenium2+Python:Webdriver API速记手册
由于web自动化常常需要控制浏览器行为和操作页面元素,相关函数又比较多,于是再此记下一份Webdriver API查阅文档以备不时之需. 参考:虫师<Selenium2自动化测试实战>,和 ...
- webdriver API中文文档
1.1 下载selenium2.0的lib包 http://code.google.com/p/selenium/downloads/list 官方UserGuide:http://seleniu ...
- python+selenium自动化软件测试(第2章):WebDriver API
2.1 操作元素基本方法 前言前面已经把环境搭建好了,从这篇开始,正式学习selenium的webdriver框架.我们平常说的 selenium自动化,其实它并不是类似于QTP之类的有GUI界面的可 ...
- Selenium WebDriver Api 知识梳理
之前一直没有系统的梳理WebDriver Api的相关知识,今天借此机会整理一下. 1.页面元素定位 1.1.8种常用定位方法 # id定位 driver.find_element_by_id() # ...
- 2.28 查看webdriver API
2.28 查看webdriver API(带翻译) 前言 前面都是点点滴滴的介绍selenium的一些api使用方法,那么selenium的api到底有多少呢?本篇就教大家如何去查看seleni ...
- python2.7运行selenium webdriver api报错Unable to find a matching set of capabilities
在火狐浏览器33版本,python2.7运行selenium webdriver api报错:SessionNotCreatedException: Message: Unable to find a ...
随机推荐
- noip2012开车旅行 题解
题目大意: 给出n个排成一行的城市,每个城市有一个不同的海拔.定义两个城市间的距离等于他们的高度差的绝对值,且绝对值相等的时候海拔低的距离近.有两个人轮流开车,从左往右走.A每次都选最近的,B每次都选 ...
- Thupc2017"礼"?
题面 先粘上gouzhi的题面,听说是thupc的题 [问题背景] 情人节要到了,zhx 要给女朋友买礼物. [问题描述] 橱窗里摆放了 n 种不同的玩偶,购买第 i 种玩偶需要价格 a[i],价值为 ...
- BZOJ 4403 序列统计(Lucas)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=4403 [题目大意] 给定三个正整数N.L和R,统计长度在1到N之间, 元素大小都在L到 ...
- [UOJ62]怎样跑得更快
以下用等号代替同余 这个式子是$\sum\limits_{j=1}^n(i,j)^{c-d}i^dj^dx_j=b_i$ 令$g(n)=\sum\limits_{e|n}\mu\left(\frac ...
- 【动态规划】CDOJ1271 Search gold
方格取数. 但由于题意说金币数<0就死了,就不能继续转移. #include<cstdio> #include<algorithm> #include<cstrin ...
- 【动态规划去除冗余】NOIP2010-乌龟棋
[题目大意] [思路] 最简单的思路是五维数组,但是当前走到的步数由已经取到的卡片决定,所以只需要四维.本来想要改一个滚动数组的,但是好像没有滚起来,算了(ノ`Д)ノ. 在学校要晚自习到21:15,回 ...
- “过时”的SpringMVC我们到底在用什么?深入分析DispatchServlet源码
之前已经分析过了Spring的IOC(<零基础带你看Spring源码--IOC控制反转>)与AOP(<从源码入手,一文带你读懂Spring AOP面向切面编程>)的源码,本次就 ...
- Atom | 编辑器Atom的使用小结
文章目录 windows环境下 Atom工具使用apm Packages 推荐阅读 常用快捷键 windows环境下 Atom工具使用apm 在 Atom 的安装路径下找到 apm ,复制路径: 将该 ...
- [转]jQuery 双击事件(dblclick)时,不触发单击事件(click)
例1: 链接:http://www.w3school.com.cn/jquery/event_dblclick.asp HTML 系列教程 浏览器脚本 服务器脚本 ASP.NET 教程 XML 系列教 ...
- [HTML/CSS]div显示在object、embed之上~
引言 帮一个朋友弄前端布局,一切都正常,但是嵌入object之后,div总是在object的下面,就上网找了一下解决方案,这里记录一下,好像只对flash有效. 用embed插入一个flash(比如优 ...