basic-navigation Scenario 7 — Extract src Attribute of First Gallery Image
Written by RTILA X Engineering Team
Intermediate ~6 min
What You'll Learn
Extract the src attribute of the first image in a gallery
Real-World Use Case
Pulling product image URLs for a catalog
LIVE DEMO
Product Gallery
Five image placeholders with stable src and alt attributes.




EXPECTED OUTPUT
First Gallery Image Source
/images/product-1.jpg
RTILA X PROJECT JSON
RTILA X Automation Project
extract-first-image-src.json
{
"name": "Extract_src_Attribute_Of_First_Gallery_Image",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/basic-navigation/7"
]
},
"datasets": {},
"commands": [
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/basic-navigation/7"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=.product-gallery img"
}
},
{
"command": "get_attribute",
"params": {
"selector": "css=.product-gallery img",
"attribute": "src"
}
}
]
}
RTILA X Concepts
get_attribute returns the value of the specified attribute for the
first element matching the selector. Waiting for the image selector first ensures
the gallery is ready.
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 1 RTILA X command and is referenced in 2 learning articles.
Continue Learning
Was this helpful?
Thank you for your feedback!