-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.robot
86 lines (70 loc) · 2.92 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
*** Settings ***
Documentation Orders robots from RobotSpareBin Industries Inc.
... Saves the order HTML receipt Oas 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 auto_close=${False}
Library RPA.HTTP
Library RPA.Excel.Files
Library RPA.PDF
Library RPA.Tables
Library RPA.Archive
*** Tasks ***
Orders robots from RobotSpareBin Industries Inc.
Open the robot order website
${orders}= Get orders
FOR ${order} IN @{orders}
Log ${order}
Fill the form ${order}
Wait Until Keyword Succeeds 5x 2s Submit
${pdf}= Store the receipt as a PDF file ${order}[Order number]
${screenshot}= Take a screenshot of the robot ${order}[Order number]
Embed the robot screenshot to the receipt PDF file ${screenshot} ${pdf}
Order another robot
END
Create zip file
*** Keywords ***
Open the robot order website
Open Available Browser https://robotsparebinindustries.com/#/robot-order
Click Button OK
Get orders
Download
... https://robotsparebinindustries.com/orders.csv
... target_file=${OUTPUT DIR}${/}orders.csv
... overwrite=True
${orders}= Read table from CSV orders.csv
RETURN ${orders}
Fill the form
[Arguments] ${order}
Select From List By Value head ${order}[Head]
Select Radio Button body ${order}[Body]
Input Text xpath://input[contains(@placeholder,'Enter the part number')] ${order}[Legs]
Input Text address ${order}[Address]
Click Button Preview
Submit
Click Button Order
Wait Until Element Is Visible id:receipt
Store the receipt as a PDF file
[Arguments] ${orderid}
#Wait Until Element Is Visible id:receipt
${receipt_html}= Get Element Attribute id:receipt outerHTML
Html To Pdf ${receipt_html} ${OUTPUT DIR}${/}receipts${/}Receipt${orderid}.pdf
RETURN ${OUTPUT DIR}${/}receipts${/}Receipt${orderid}.pdf
Take a screenshot of the robot
[Arguments] ${orderid}
Screenshot xpath://div[@id='robot-preview-image'] ${OUTPUT DIR}${/}screenshots${/}Robot${orderid}.png
RETURN ${OUTPUT DIR}${/}screenshots${/}Robot${orderid}.png
Embed the robot screenshot to the receipt PDF file
[Arguments] ${screenshot} ${pdf}
Open Pdf ${pdf}
Add Watermark Image To PDF
... image_path=${screenshot}
... source_path=${pdf}
... output_path=${pdf}
Close Pdf
Order another robot
Click Button xpath://button[@id='order-another']
Click Button OK
Create zip file
Archive Folder With Zip ${OUTPUT DIR}${/}receipts Receipt_PDF.zip