Hi all
I wanted to know how can i detect javascript alert popup after certain tasks i have used xclick, executeScript, but nothing works
im using website where i want to click on button then website shows javascript alert popup but its random sometimes website shows 1 alert sometimes it shows 2 button so can we handle this? there is multiple button i want like click button one by one but because of random popup count i cant do that so how i can detect popup button.
i want to add functionality click button then close the all js alert button then continue the so on
My code:
{
"Name": "Save All",
"CreationDate": "2024-11-24",
"Commands": [
{
"Command": "store",
"Target": "1",
"Value": "i",
"Description": "Initialize counter"
},
{
"Command": "while",
"Target": "${i} <= 10",
"Value": "",
"Description": "Loop through 10 buttons"
},
{
"Command": "click",
"Target": "xpath=(//button[@id='is_finalized'])[${i}]",
"Value": "",
"Description": "Click the nth button"
},
{
"Command": "pause",
"Target": "500",
"Value": "",
"Description": "Wait for alert to appear"
},
{
"Command": "executeScript",
"Target": "window.alert && alert('');",
"Value": "",
"Description": "Close the alert programmatically"
},
{
"Command": "executeScript",
"Target": "return Number(${i}) + 1;",
"Value": "i",
"Description": "Increment counter"
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": "End of loop"
}
]
}