1. Open App,open application Http://localhost:4723/wd/hub platformname=android platformversion=4.3
devicename=127.0.0.1:62001 Apppackage=.debug appactivity=. Mainactivity.
I'm using the simulator, I need to manually add the device using the simulator, that is, the ADB connect 127.0.0.1:62001,devicename is the device name, which I write is 127.0.0.1:62001. If you use a real machine, you need to pass the query to know, ADB devices. Using the real machine, sometimes encounter the computer can not recognize the phone, and the developer options are open, this time need to download 360 mobile phone assistant such software on the PC and mobile phone, through the identification of the software will be on the phone to pop up a debug option, choose to debug, adb devices can get the device name. I've only tried 360, and other types of software should also be available.
Packages and activity are the package name and path of the app. Simple to get the method for, download the client version of Appium, on the PC downloaded APK, and then select the package apk on the Appium, after the choice, appium and activity came out.
2.AppiumLibrary in conjunction with selenium2library, you need to add the library name before the keyword. such as appiumlibrary.click element, because there are many keyword of the two libraries are the same, An error is indicated when the library name is not added.
3. When there is a possibility of an indeterminate number of redemptions, you need to click the Redeem button by appending the location.
xpath=//android.widget.textview[@text = "Append"]/: /preceding-sibling::android.view.view/android.widget.textview[@text = "Redemption"]; If you want to position it in the back, You need to change the preceding-sibling to following-sibling.
If you are in the same class, you need to add "/" before following-sibling, such as xpath=//android.widget.textview[@text = ' ${code} ']/following-sibling:: ANDROID.WIDGET.TEXTVIEW[4]
4. For text to change with the data changes can be used fuzzy positioning,
Xpath=//android.widget.edittext[contains (@text, "redeemable Share:")], unlike Selenium2library, the text is added @.
5. Sometimes there will be some no name or ID of the view, with the third method also cannot be positioned, then you can use click a point, but the screen different points of the coordinates will be different, so there is no way to try not to use the case. Click a point420700,420 is the x-coordinate, and 700 is the y-coordinate.
6. Get the value of text with the thousand symbol in the replacement amount, but the replacement data type is STR, and the database gets the data bit float, direct should be equal will error, need to use should be equal as String.
In addition, to write SQL in the robotframework, you need to remove the semicolon, or you will be prompted SQL does not properly end the error.
There is also a replacement method for using the string library that comes with robotframework.
My robotframework version here is 1.5.2.1, if it is 2.8.2 or more can use the remove string.
For data, the obtained text is STR, and the database data is float, so there will be 29006.6! = 29006.60 case, so you still have to convert Str to float, that is
${c} evaluatefloat (${b})
7. Determine if the purchase amount is higher than the minimum limit
Here, I did not find a direct comparison of the keywords, but by subtracting, to determine whether the result should be positive or negative.
${minbuys} is the minimum purchase amount to be queried from the database, but it is a list that needs to be assigned. Buyamount is the purchase amount, when Buyamount and minbuy are equal, is allowed to buy, subtraction will be equal to 0, so need to add 1 later.
In addition, when using the Run keyword if, you need to be aware that the location of the additional purchase amount can only write keywords, so the functions that cannot be implemented directly can be encapsulated and then called. The else must be capitalized, otherwise it will become the argument of the previous sentence and report the error of entering too many parameters.
8. Input Box
Floating-point variable input box will be an error, this time need to convert him into a string, the code is as follows:
9. Write keyword in RF, determine whether the condition is satisfied, the return of the following code is not executed directly, the return from keyword if, followed by two 0, is the value of the returned parameter.
10. Exit For loop, with Exit For loop
Continuous update ....