Hi guys. I’m trying to write a script that goes through multiple open tabs, one by one, and searches for a form to fill. My problem is, it doesn’t go further than tab 1. If I have 10 tabs open, I want the script to go one-by-one, through each tab until it finds the form and it fills it. Is that possible? Sorry. I’m new to this
Here’s my current code that doesn’t work as intended.
{
"Name": "Draft 1",
"CreationDate": "2023-4-16",
"Commands": [
{
"Command": "label",
"Target": "p1",
"Value": "",
"Description": ""
},
{
"Command": "selectWindow",
"Target": "tab=1",
"Value": "",
"Description": ""
},
{
"Command": "visualSearch",
"Target": "t1dpi_96.png",
"Value": "x",
"Description": ""
},
{
"Command": "if",
"Target": "${x}!==0",
"Value": "p1",
"Description": ""
},
{
"Command": "click",
"Target": "name=email",
"Value": "",
"Targets": [
"name=email",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div/div/input",
"xpath=//input[@name='email']",
"xpath=//input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(1) > div > input"
],
"Description": ""
},
{
"Command": "type",
"Target": "name=email",
"Value": "ilovespacerocks@yahoo.com",
"Targets": [
"name=email",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div/div/input",
"xpath=//input[@name='email']",
"xpath=//input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(1) > div > input"
],
"Description": ""
},
{
"Command": "click",
"Target": "name=new_field_2",
"Value": "",
"Targets": [
"name=new_field_2",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div[2]/div/input",
"xpath=//input[@name='new_field_2']",
"xpath=//div[2]/div/input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(2) > div > input"
],
"Description": ""
},
{
"Command": "type",
"Target": "name=new_field_2",
"Value": "greafra",
"Targets": [
"name=new_field_2",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div[2]/div/input",
"xpath=//input[@name='new_field_2']",
"xpath=//div[2]/div/input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(2) > div > input"
],
"Description": ""
},
{
"Command": "click",
"Target": "name=new_field_3",
"Value": "",
"Targets": [
"name=new_field_3",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div[3]/div/input",
"xpath=//input[@name='new_field_3']",
"xpath=//div[3]/div/input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(3) > div > input"
],
"Description": ""
},
{
"Command": "type",
"Target": "name=new_field_3",
"Value": "gafafdsad",
"Targets": [
"name=new_field_3",
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div[3]/div/input",
"xpath=//input[@name='new_field_3']",
"xpath=//div[3]/div/input",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(3) > div > input"
],
"Description": ""
},
{
"Command": "click",
"Target": "xpath=/html/body/div[4]/div/div/div/form/div[3]/div[4]/button",
"Value": "",
"Targets": [
"xpath=/html/body/div[4]/div/div/div/form/div[3]/div[4]/button",
"xpath=//button[@type='submit']",
"xpath=//button",
"css=body > div.pm-module.pm-module--petra > div > div > div > form > div.form__fields.space-y-4 > div:nth-child(4) > button"
],
"Description": ""
},
{
"Command": "visualVerify",
"Target": "yj0ss_96.png",
"Value": "sub1",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "gotoLabel",
"Target": "p1",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
Thanks for any help.