-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.robot
95 lines (73 loc) · 3.15 KB
/
tasks.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# +
*** Settings ***
Documentation Orders robots from RobotSpareBin Industries Inc.
... Saves the order HTML receipt as a PDF file.
... Saves the screenshot of the ordered robot.
... Embeds the screenshot of the robot to the PDF receipt.
... Creates ZIP archive of the receipts and the images.
Library RPA.Browser.Selenium
Library RPA.HTTP
Library RPA.Tables
Library RPA.PDF
Library RPA.Archive
Library Dialogs
Library RPA.Robocorp.Vault
*** Variables ***
${Orders CSV URL}= https://robotsparebinindustries.com/orders.csv
${Orders URL}= https://robotsparebinindustries.com/#/robot-order
# +
*** Keywords ***
Open the robot order website
Open Available Browser ${Orders URL}
Get Orders
${secret}= Get Secret urls
${Orders CSV URL}= Get Value From User Url for robot orders to be created? ${secret}[Orders CSV URl]
Download ${Orders CSV URL} overwrite=True
${Orders Table}= Read table from CSV orders.csv header=True
[Return] ${Orders Table}
Close Modal
Click Button When Visible //button[@class="btn btn-dark"]
Fill The Form
[Arguments] ${row}
Scroll Element Into View //button[@id="preview"]
Select From List By Value //select[@name="head"] ${row}[Head]
Click Element xpath=(//input[@name="body"])[${row}[Body]]
Input Text xpath://html/body/div/div/div[1]/div/div[1]/form/div[3]/input ${row}[Legs]
Input Text //input[@name="address"] ${row}[Address]
Preview Robot
Click Element //button[@id="preview"]
Wait Until Element Is Visible //*[@id="robot-preview-image"]
Scroll Element Into View //*[@id="robot-preview-image"]
Screenshot id:robot-preview-image ${CURDIR}\\images\\robot.png
Submit Order
Click Element //button[@id="order"]
FOR ${i} IN RANGE 0 100
${sucessfullyOrdered}= Is element visible //button[@id="order-another"]
Exit For Loop If ${sucessfullyOrdered} == True
Click Element //button[@id="order"]
END
Create Receipt
[Arguments] ${row}
Wait Until Element Is Visible //*[@id="receipt"]
${receipt}= Get Element Attribute id:receipt outerHTML
Html To Pdf ${receipt} ${CURDIR}\\receipts\\receipt_${row}[Order number].pdf
Add Watermark Image To Pdf ${CURDIR}\\images\\robot.png ${CURDIR}\\receipts\\receipt_${row}[Order number].pdf ${CURDIR}\\receipts\\receipt_${row}[Order number].pdf
Order Another Robot
Click Element //button[@id="order-another"]
Create a ZIP of the receipts
Archive Folder With Zip ${CURDIR}${/}receipts receipts.zip
# -
*** Tasks ***
Open the website
Open the robot order website
${orders}= Get orders
FOR ${row} IN @{orders}
Close Modal
Fill the form ${row}
Preview robot
Submit Order
${pdf}= Create Receipt ${row}
Order Another Robot
END
Close All Browsers
Create a ZIP of the receipts