Help with !TIMEOUT_WAIT / WaitForElementPresent

Hello, i am trying to use the instructions here: https://ui.vision/rpa/docs/selenium-ide/waitforelementpresent

My current JSON is found below. My problem is with this part… “Target”: “linkText=Received Inventory@POS=2”, because there is another link called “Received Inventory” and it wants to open that immediately as opposed to waiting for POS=2(second link).

Here is a snapshot of inspecting the link i am tyring to wait until it becomes visible. you can also see the link with the same name on the far left. Basically for the “linkText=Received Inventory@POS=2” to become visible you have to click a download button and then wait for the download alert bar at the top of the page (shown below highlighted in blue) and then you can click to download the report. I am able to get it to work by just putting in a long pause until it becomes visible but sometimes it downloads much faster than the fixed pause delay and would be best if i could download it immediately when it becomes visible. Please let me know if anyone has any other techniques i can try. If tried all sorts of ifs , gotolabels, and clicking the link based on alertDownload class (see screenshot) but I don’t know if i am implementing them correctly…I feel like if i had a different way to look for the “linkText=Received Inventory@POS=2” element i may be able to get it to work using my current method… thanks, brett

{
“Name”: “receivedinventory”,
“CreationDate”: “2021-1-14”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://sellercentral.amazon.com/gp/ssof/reports/searchv2.html?recordType=INVENTORY_RECEIPT”,
“Value”: “”
},
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “10000”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “linkText=Download”,
“Value”: “”,
“Targets”: [
“linkText=Download”,
“id=tab_download”,
“xpath=//[@id="tab_download"]",
“xpath=//a[@id=‘tab_download’]”,
“xpath=//div[10]/ul/li[2]/a”,
“css=#tab_download”
]
},
{
“Command”: “click”,
“Target”: “id=downloadDateDropdown”,
“Value”: “”,
“Targets”: [
“id=downloadDateDropdown”,
“name=eventDateOption”,
"xpath=//
[@id="downloadDateDropdown"]”,
“xpath=//select[@id=‘downloadDateDropdown’]”,
“xpath=//div[2]/form/table/tbody/tr/td[3]/select”,
“css=#downloadDateDropdown”
]
},
{
“Command”: “select”,
“Target”: “id=downloadDateDropdown”,
“Value”: “label=Last 30 days”,
“Targets”: [
“id=downloadDateDropdown”,
“name=eventDateOption”,
“xpath=//[@id="downloadDateDropdown"]",
“xpath=//select[@id=‘downloadDateDropdown’]”,
“xpath=//div[2]/form/table/tbody/tr/td[3]/select”,
“css=#downloadDateDropdown”
]
},
{
“Command”: “click”,
“Target”: “id=downloadDateDropdown”,
“Value”: “”,
“Targets”: [
“id=downloadDateDropdown”,
“name=eventDateOption”,
"xpath=//
[@id="downloadDateDropdown"]”,
“xpath=//select[@id=‘downloadDateDropdown’]”,
“xpath=//div[2]/form/table/tbody/tr/td[3]/select”,
“css=#downloadDateDropdown”
]
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="requestCsvTsvDownload"]/tr/td[2]/button/span",
“Value”: “”,
“Targets”: [
"xpath=//
[@id="requestCsvTsvDownload"]/tr/td[2]/button/span”,
“xpath=//tbody[2]/tr/td[2]/button/span”,
“css=#requestCsvTsvDownload > tr:nth-child(1) > td:nth-child(2) > button > span”
]
},
{
“Command”: “store”,
“Target”: “100”,
“Value”: “!TIMEOUT_WAIT”
},
{
“Command”: “onDownload”,
“Target”: “ReceivedInventory.csv”,
“Value”: “true”
},
{
“Command”: “click”,
“Target”: “linkText=Received Inventory@POS=2”,
“Value”: “”,
“Targets”: [
“linkText=Received Inventory@POS=2”,
“xpath=//*[@id="reportingAlert"]/a”,
“xpath=//div[2]/div[2]/div[2]/div/a”,
“css=#reportingAlert > a”
]
},
{
“Command”: “onDownload”,
“Target”: “ReceivedInventory.csv”,
“Value”: “true”
}
]
}

Hi, just to clarify: So the waiting fails because there is another element (at @POS=1) with the same link text?

A quick solution would be to use visual waiting (visualAssert). This avoids dealing with XPath and the whole HTML stuff :wink:

1 Like

perfect! will give this a shot. thanks so much for your reply.