ecommerce Scenario 4 — Add to Cart and Extract Order Total
Written by RTILA X Engineering Team
Intermediate ~6 min
Prerequisites: ecommerce/1 ecommerce/2
What You'll Learn
Handle variant selection (size, colour)
Real-World Use Case
Collecting inventory for all product variants
LIVE DEMO
Wireless Headphones
$299.99
EXPECTED OUTPUT
RTILA X PROJECT JSON
{
"name": "Add_To_Cart_Checkout",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/ecommerce/4"
]
},
"datasets": {
"order_summary": {
"item_selector": "css=.order-summary",
"properties": [
{
"name": "total",
"type": "text",
"selector": "css=.order-total"
},
{
"name": "message",
"type": "text",
"selector": "css=.order-message"
}
]
}
},
"commands": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=#add-to-cart"
}
},
{
"command": "click",
"params": {
"selector": "css=#add-to-cart"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=.cart-items"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=#go-checkout"
}
},
{
"command": "click",
"params": {
"selector": "css=#go-checkout"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=.checkout-form"
}
},
{
"command": "fill",
"params": {
"selector": "css=#ship-name",
"value": "Jane Smith"
}
},
{
"command": "fill",
"params": {
"selector": "css=#ship-address",
"value": "123 Main Street"
}
},
{
"command": "fill",
"params": {
"selector": "css=#ship-city",
"value": "Springfield"
}
},
{
"command": "fill",
"params": {
"selector": "css=#ship-zip",
"value": "12345"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=#place-order"
}
},
{
"command": "click",
"params": {
"selector": "css=#place-order"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=.order-summary"
}
},
{
"command": "extract_data",
"params": {
"dataset": "order_summary"
}
}
]
}
Cart automation chains multiple state changes: add to cart, advance to checkout, fill shipping fields, place the order, and capture the final total.
Did you complete this scenario?
Ready to run this automation?
Copy the project JSON above, open RTILA X, create a new project, and paste it.
This scenario covers 2 RTILA X commands and is referenced in 1 learning article.
Continue Learning
Was this helpful?
Thank you for your feedback!