zoukankan      html  css  js  c++  java
  • [Selenium.2.Testing.Tools.Beginners.Guide]读书笔记

    1. 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.
    2. Verify, allows the test to check the element is on the page, but if it isn't then the test will carry on executing
    3. 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.
    4. 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.
    5. 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.
    6. 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.
    7. Xpath = //element[@attribute=’attribute value’]
    8. WebDriver tries to control the browser from outside the browser. It uses accessibility API to drive the browser.
    9. We can create an object that represents the page and then pass the Selenium object in the programming language.
    10. 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.
    11. 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
    12. All the methods for doing actions to the web application like typing and clicking require that we find the element first
    13. 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
    14. findElement calls will return a WebElement object that we can perform actions on
    15. 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
    16. 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
    17. 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.
    18. 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.
    19. 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.*;
    20. Capturing images as base64 strings: String screenshotBase64 = ((Screenshot)driver).getScreenshotAs(base64);
    21. Saving images to bytes: Bytes screenbytes = ((Screenshot)driver).getScreenshotAs(bytes);
    22. Saving screenshots to files:  File saveImage = ((Screenshot)driver).getScrennshotAs(file)
    23. Verify allows a test to continue and keep track of all verify errors. Assert will stop a test immediately when the assert fails
    24. 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
    25. 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
    26.  
  • 相关阅读:
    基于HttpListener的web服务器
    基于TcpListener的web服务器
    一个简单的web服务器
    c# 6.0新特性(二)
    c# 6.0新特性(一)
    c#之Redis实践list,hashtable
    html5摇一摇[转]
    在Microsoft-IIS/10.0上面部署mvc站点的时候,出现404的错误
    [实战]MVC5+EF6+MySql企业网盘实战(28)——其他列表
    让DELPHI自带的richedit控件显示图片
  • 原文地址:https://www.cnblogs.com/bluescorpio/p/3560008.html
Copyright © 2011-2022 走看看