In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Usually we can use robot framework to write interface automation use cases, but what if some sites do not do front-end separation, there is a lot of repeated testing workload in the iterative process, there is no interface to call verification, and there are automated testing requirements? At this time, the frequent pit of web UI automation is imperative. Robot is only an automation framework, but it is stable and scalable. To drive web browser to work automatically, you only need to install another artifact, selenium. The following outline introduces how to get started with web UI. Once you enter the door, the rest is the workload of baidu and see the official website to help. It is recommended to use it in search, otherwise it will be useless.
Use case writing prerequisites:
Robot/python3 environment has been deployed. For more information, please see: install selenium, recommend 3.11.0 version: pip install selenium==3.11.0 install robotframework-seleniumlibrary, recommend 3.1.1 version: pip install robotframework-seleniumlibrary==3.1.1 install webdriver, recommend the more popular chromedriver, download: http://chromedriver.storage.googleapis.com/index.html from here
The version of chromedriver needs to correspond to the local chrome browser before it can be used normally. Download the corresponding version of the chromedriver driver file, and the corresponding relationship table of the specific version:
Chromedriver version | supported Chrome version
V2.33 | v60-62
V2.32 | v59-61
V2.31 | v58-60
V2.30 | v58-60
V2.29 | v56-58
V2.28 | v55-57
V2.27 | v54-56
V2.26 | v53-55
V2.25 | v53-55
V2.24 | v52-54
V2.23 | v51-53
V2.22 | v49-52
V2.21 | v46-50
V2.20 | v43-48
V2.19 | v43-47
V2.18 | v43-46
V2.17 | v42-43
V2.13 | v42-45
For window platform, decompress it and put it in the file path of the local chrome browser, such as:
C:\ Program Files (x86)\ Google\ Chrome\ Application
Or add the decompression address of chromedriver to the system path.
Reference the selenium package * * Settings * * Library CollectionsLibrary SeleniumLibrary in the use case file
An example is as follows:
* Test Cases * my first html # create a chrome browser Open Browser http://www. My domain name .cn / chrome # input text box input text id=inputName admin input text id=inputPassword admin input text id=inputCode 123 # Click button Click Button Xpath=//form/div/span/button # Click A tag | locator represents locator # Click Link | locator # Click a label # Click Element Xpath=//ul [@ id='systemSetting0'] ${cnt} get title log ${cnt} ${title} get window titles log ${title} Title Should Be a background Location should Contain http://www. My domain name .cn / Page Should Not Contain does not contain my Page Should Contain must contain me # close the open browser Close Browser Close All Browsers
When you execute the use case, you will see that a chrome opens automatically, enters the password, clicks on the login, and may not be able to see clearly. In order to see clearly, you can use the sleep method to stop at each step for a few seconds:
# the unit here is second sleep 3
Of course, if your web loads slowly, it is unreliable to stay for a few seconds to avoid it, so this method is recommended:
Wait Until Page Contains Element official documentation
Http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.