I’m dealing with this: I click a button that opens a new tab, takes some seconds to load and when it loads I need to click in a button that is behind 2 iframes, But in order to use “SelectFrame | index=0”, I need to be sure that the page is already loaded.
Is there a way to do something like waitForElementPresent | title = "*some string*?
Here is what ChatGPT told me, and it sounds correct:
To wait for a change in the title text using UI.Vision RPA, you would typically use a combination of commands in a loop to periodically check for the title until it matches your desired condition. Since UI.Vision RPA does not have a direct command like waitForElementPresent specifically for page titles, you’d need to implement a custom loop that checks the title at intervals. Here’s a conceptual approach:
Store the Initial Title: Use the storeTitle command to save the current page title in a variable.
Loop Until the Title Changes: Implement a loop using the while | !${done} structure. Within this loop, you will:
Use storeTitle again to check the current title and store it in another variable.
Use the if command to compare the new title variable to your expected title or to check if it contains a specific string.
If the title matches your criteria, set a variable (e.g., ${done}) to true to break the loop.
If the title does not match, use pause to wait for a short period before checking again.
Proceed Once the Title Matches: After the loop exits, you can proceed with your actions, such as interacting with elements inside the iframes.
Here is a simplified version of the script steps you might use:
store | false | done
label | startLoop
storeTitle | currentTitle
if | "${currentTitle}" == "YourExpectedTitleHere" | |
store | true | done
endIf
if | "${done}" == "false" | |
pause | 1000 // Wait for 1 second before checking the title again
gotoLabel | startLoop
endIf
// Your next actions go here, after the title has changed to the expected value.
This script checks for a title exactly matching “YourExpectedTitleHere”. If you’re looking for a title that contains a certain string (e.g., part of the title), you’d modify the condition in the if command accordingly.
Please adjust the intervals and conditions based on your specific needs and the behavior of the website you’re automating.