You are correct, the normal way to scrape the link URL with storeAttribute | xpath=//*[@id=\"main-...../h3@href"
fails with missing attribute 'href'
error.
My suggested workaround is to click on the title, and then simply scrape the URL of the new web page with the
${!URL}
variable. Then go back to the list, and repeat the same for the next item in the list.
Test macro:
{
"Name": "yahoo news1",
"CreationDate": "2025-8-8",
"Commands": [
{
"Command": "open",
"Target": "https://finance.yahoo.com/quote/JNJ/news/?guccounter=1&guce_referrer=aHR0cHM6Ly9mb3J1bS51aS52aXNpb24v&guce_referrer_sig=AQAAAI5dTvwiEXhsbuqrHNJ8AM2fA2HY5b7tFxeM0xKc1BEZ8k6O6cL9-9d9EDJXNV4AUfPppjZykKeABILzrgQ8B316mCgwKEvAscJyD5lu3L6jepEvGNmttPplnUDueE9CTyMOTv_guAXRIg3W4YXUPnoS5Yc2wVAe3SteY_84Myf7",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"main-content-wrapper\"]/section[3]/section/div/div/div/div/ul/li[4]/section/div/a/h3",
"Value": "t",
"Description": ""
},
{
"Command": "echo",
"Target": "Text = ${t}",
"Value": "green",
"Description": ""
},
{
"Command": "comment",
"Target": "storeAttribute // xpath=//*[@id=\"main-content-wrapper\"]/section[3]/section/div/div/div/div/ul/li[4]/section/div/a/h3@href",
"Value": "u",
"Description": "This fails, as there is no href attribute, so instead lets click on the link"
},
{
"Command": "click",
"Target": "xpath=//*[@id=\"main-content-wrapper\"]/section[3]/section/div/div/div/div/ul/li[4]/section/div/a/h3",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "${!URL}",
"Value": "u",
"Description": ""
},
{
"Command": "echo",
"Target": "Text URL = ${u}",
"Value": "blue",
"Description": ""
},
{
"Command": "executeScript",
"Target": "window.history.back()",
"Value": "",
"Description": "Go Back"
}
]
}