[Selenium.2.Testing.Tools.Beginners.Guide]读书笔记
- Assert, this allows the test to check if the element is on the page, if it is not available then the test will stop on the step that failed.
- Verify, allows the test to check the element is on the page, but if it isn't then the test will carry on executing
- AJAX stands for Asynchronous JavaScript And XML due to the facts that it relies on JavaScript creating asynchronous calls and then returning XML with the data that the user or application requires to carry on.
- AJAX applications do not have the items needed for the tests when the tests get to commands. To get around this we had a look at adding waitFor commands to the tests. This is due to the fact that Selenium does not implicitly wait for elements to appear in the page.
- Elements should have an ID attribute for all their controls on the page. A control would be an element that we can interact with and is not static text.
- Having // as the start of your XPath is seen as a greedy query since it will parse the entire DOM until it finds the element that you want to find.
- Xpath = //element[@attribute=’attribute value’]
- WebDriver tries to control the browser from outside the browser. It uses accessibility API to drive the browser.
- We can create an object that represents the page and then pass the Selenium object in the programming language.
- Page Object: this is a technique where we split the test logic out into separate classes. This allows us to create a Java class for each of the pages that we use on the page.
- Page Factory: this allows us to decorate our WebElement variables in our page objects so that we remove a lot of the look up code
- All the methods for doing actions to the web application like typing and clicking require that we find the element first
- findElementByID(String using), the using variable takes the ID of the element that you wish to look for. It will return a WebElement object that we can then work with
- findElement calls will return a WebElement object that we can perform actions on
- findElementByClassName(). If there is more than one element on the page that has this class name, then it will return the first element that it gets
- Finding if an element exists without throwing an error: use the findElements() call, and then we just need to check that the size of the list returned is 0
- Selenium Grid is a version of Selenium that allows teams to set up a number of Selenium instances and then have one central point to send your Selenium commands to.
- Selenium Grid works by having a central point that tests can connect to, and then commands are pushed to Selenium server nodes that are connected to the hub. The hub has a web interface that tells you about the Selenium Server and the browser instances connected to the hub and if they are currently in use.
- Screenshots capability lives within an interface called TakesScreenshot. We will cast the driver to this and then use the interface to access getScreenshotAs() method. You will also need to import the following library: import static openqa.selenium.OutputType.*;
- Capturing images as base64 strings: String screenshotBase64 = ((Screenshot)driver).getScreenshotAs(base64);
- Saving images to bytes: Bytes screenbytes = ((Screenshot)driver).getScreenshotAs(bytes);
- Saving screenshots to files: File saveImage = ((Screenshot)driver).getScrennshotAs(file)
- Verify allows a test to continue and keep track of all verify errors. Assert will stop a test immediately when the assert fails
- The Page Object design pattern gives us a way to abstract our tests away so that we can make these tests more maintainable. We can make tests that only require updating if new steps have been added, otherwise it just requires the page object to be updated
- Using ChromeDriver, the PATH environment variable needs to be set with where the ChromeDriver executable lives. This is so that when we call ChromeDriver with our Java code, it will load the relevant executable and load the browser as quickly as possible
[Selenium.2.Testing.Tools.Beginners.Guide]读书笔记的更多相关文章
- [Spring Boot Reference Guide] 读书笔记一 Getting Started
8. Introducing Spring Boot Goals of spring boot: Provide a radically faster and widely accessible ge ...
- advanced bash shell guide读书笔记
http://note.youdao.com/noteshare?id=fc23a679849b4627d131d3ef07c74a71
- 读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit
读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit Author: Andrew Hunt ,David Thomas with Matt ...
- 读书笔记-Software Testing(By Ron Patton)
Software Testing Part I:The Big Picture 1.Software Testing Background Bug's formal definition 1.The ...
- 【Tools】Pro Git 一二章读书笔记
记得知乎以前有个问题说:如果用一天的时间学习一门技能,选什么好?里面有个说学会Git是个很不错选择,今天就抽时间感受下Git的魅力吧. Pro Git (Scott Chacon) 读书笔记: ...
- 读书笔记:《梦断代码Dreaming in Code》
读书笔记:<梦断代码Dreaming in Code> 拿到<梦断代码>书后,一口气翻了一遍,然后又用了3天时间仔细读了一遍,也不禁掩卷长叹一声,做软件难.虽难,仍要继续走下去 ...
- SystemTap Beginners Guide
SystemTap 3.0 SystemTap Beginners Guide Introduction to SystemTap Edition 3.0 Red Hat, Inc. Don Do ...
- The Pragmatic Programmer 读书笔记之中的一个 DRY-Don’t Repeat Youself
The Pragmatic Programmer读书笔记之中的一个 DRY-Don't Repeat Youself 尽管自己买了非常多软件project方面的书,可是由于时间的问题.一直没有静 ...
- HDFS Federation (读书笔记)
HDFS Federation (读书笔记) HDFS的架构 HDFS包含两个层次:命名空间管理(Namespace) 和 块/存储管理(Block Storage). 命名空间管理(Namespac ...
随机推荐
- MySQL加载配置文件的顺序
MySQL5.6启动时,按照下表,从上往下的顺序加载配置文件: File Name Purpose /etc/my.cnf Global options /etc/mysql/my.cnf Globa ...
- Redis快速入门及应用
Redis的使用难吗?不难,Redis用好容易吗?不容易.Redis的使用虽然不难,但与业务结合的应用场景特别多.特别紧,用好并不容易.我们希望通过一篇文章及Demo,即可轻松.快速入门并学会应用.一 ...
- RecylerView 的使用方法
package com.cardvalue.sys.fragment; import android.content.Intent; import android.net.Uri; import an ...
- http1.0 和 http1.1 主要区别
1.背景 KeepAlive是就是通常所称的长连接.KeepAlive带来的好处是可以减少tcp连接的开销,这对于短response body的请求效果更加明显.同时,可以为采用HTTP协议的交互 ...
- C# Split() 去除 \r\n 分组
str为读入的文本string[] ReadText = str.Replace("\r\n", "@").Split('@'); 转自 http://zhid ...
- 修改 Semantic UI 中对 Google 字体的引用
在第一次尝试 Semantic UI 后,发现其 css 中第一行,就引用了 fonts.googleapis.com 中的字体. 不知道为什么要这么做,也许在国外,google 的服务已经是一种互联 ...
- [hihoCoder] 第五十二周: 连通性·一
题目1 : 连通性·一 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 还记得上次小Hi和小Ho学校被黑客攻击的事情么,那一次攻击最后造成了学校网络数据的丢失.为了避免再 ...
- iOS 中strong,weak,copy,assign区别
1:ARC环境下,strong代替retain.weak代替assign2:weak的作用:在ARC环境下,,所有指向这个对象的weak指针都将被置为nil.这个T特性很有用,相信很多开发者都被指针指 ...
- 对于在Android Studio 的 build.gradle 中的默认applicationId 要不要写呢?
起因 刚完成一个版本的开发.刚上Google play 就有用户反映无法更新应用.错误代码为:Can't install app "****" can' be installed. ...
- 使用Karma、Mocha实现vue单元测试
Karma Karma是一个基于Node.js的JavaScript测试执行过程管理工具(Test Runner).该工具在Vue中的主要作用是将项目运行在各种主流Web浏览器进行测试.换句话说,它是 ...