1. Locate the Buy button
Here, I wrote//td[@class = ' Text-center ']/button[@class = ' ng-isolate-scope ']/span[text () = ' buy '), prompting for no element found, The reason is the class value of the button, and I changed it to class= ' btn btn-outline ng-isolate-scope btn-xs Btn-danger ' to capture it.
In addition, I would like to locate the Buy button through the following economy hybrid A, which can be written by xpath,//a[text () = ' Medium melt New Economy hybrid a ']/. /following-sibling::td[@class = ' text-center ']/button/span[text () = ' buy '] here the button's class is not writable. Following is after, preceding is before, the usage is the same.
2. The interface is very long, the button is below the interface, the error is that the element can not be clicked, the focus should be used to locate the interface will automatically decline, and then click or other actions.
3. Fractional rounding has several methods, Math.ceil (), Math.floor (), Math.Round ().
Math.ceil () is rounded up, and the value of 25.1, 25.2, 25.9 is 26
Math.floor () is rounded down, with a value of 25.1, 25.2, and 25.9 being 25
The Math.Round () is rounded.
4. To get a value from a JSON string in a database, you need to assign the query to the data, because the database gets a list, and it is handled illegally. The Parse json is a keyword in httplibrary.http and can be converted to dictionary, so you can get the value in JSON, get from Dictionary is a keyword robotframework comes with the collections library. The to JSON keyword in requestslibrary, the parse JSON keyword in httplibrary.http, and the loads keyword in JSON, all three keyword can convert json to dictionary.
1, requestslibrary, installation command: PIP install requests
2, httplibrary, installation command: Pip install Robotframework-httplibrary
3, httplibrary.http, this library is in the Httplibrary, HTTP is a class of httplibrary
4. JSON, install command: Pip install Jsonpatch
When you turn JSON into a dictionary, sometimes errors occur, it is important to note that the conversion is not the JSON format, is not a double quotation marks, is not a space, if not double quotation marks, or a space, you need to replace, otherwise you cannot convert.
5. When this selection box is encountered, the action of selecting the first element in its box is as follows
6. Control the scroll wheel, make the Web interface swipe up and down, use Selenium2library's keyword Execute Javascript, the later the larger, the more downward, slide up the use of negative numbers. Execute Javascript document.documentelement.scrolltop=10000
Focus can also be used for focusing, a personal recommendation to use focus, followed by the element path, more accurate, but sometimes some elements can not do focus only with execute JavaScript.
7. Uploading Attachments
8. Create array in Robotframework array is actually the list, use the BUILTIN library's create list, as follows:
9. Use SQL to query Chinese data in RF, and return data like "\xe4\xb8\xad\xe5\x9b\xbd\xe5\x86\x9c\xe4\xb8\x9a\xe9\x93\xb6\xe8\xa1\x8c ..." , you need to convert the data type to Utf-8, as follows
After the conversion, you can become Chinese.
10. Import your own Python file, display red, you need to pay attention to the file class name to match the filename, otherwise it will error.
11. The variable retains two digits after the decimal point, with convert to number ${a} 2, which is the keyword for the built-in library Buildin.
12. An error occurred while running maximize Browser window because the chromederive version is too low and is available after the version is updated. Download EXE file does not need to install, put in the Python27 file on the line, you need to first delete the original version. Other types of problems can also be tested for webderive version issues. Continuous update ...