0

I've been trying to make a loop that repeats itself until an does not element exists on the page. However, when the condition is met, the loop does not exit. Any suggestions?

Dim userExt
userExt = 1
Do until Not Browser("Some_browser").Page("Some_page").WebElement("This username is already").exist
  Browser("Some_browser").Page("Some_page").WebEdit("WebEdit").Set "registertester" & userExt+1
  userExt = userExt+1
  Browser("Some_browser").Page("Some_page").WebElement("Save & Continue").Click
Loop

I also tried changing the first line to

Do until Browser("Some_browser").Page("Some_page").WebElement("This username is already").exist=False

I tried adding an if exist then exit loop, which didn't work. It just kept looping. I know for sure the element does not exist on the page.

Dor Moshe
  • 13
  • 5

1 Answers1

1

The element did not exist in the source code but for some reason UFT found it. I found that out by going on the page and click the "Highlight in Application" button in UFT. Although nothing was highlighted, UFT did not generate any error. I went on to check the properties of the element and found a property called visible.

I changed the Do Until statement to:

Do until Browser("Some_browser").Page("Some_page").WebElement("This username is already").GetROProperty("visible")="False"
Dor Moshe
  • 13
  • 5