Prakash
Prakash

Reputation: 11

Issue related to 'exist'

I am designing an automation framework for a web based application. I have used 'Exist' method to check if the user has correctly logged into the application. Something like this:

If  Browser("XXX").Page("YYY").WebElement("Either you have entered").Exist(0)
Then                 
    Browser("XXX").Page("YYY").Image("btnok").Click
    fnReset = false
Else
    If  Browser("XXX").Page("YYY").WebElement("Account Search").Exist(0) Then
        fnReset = true
    End If
    Browser("XXX").Page("YYY").Sync
End If

This code works fine , if an invalid username/password is entered as it hits the IF part first.

However, when I try with a valid username/password, the IF condition step keeps running for a long time and the ELSE part is not getting executed at all.

Is there an issue with the timing for which the test waits or is there any other problem?

Upvotes: 1

Views: 266

Answers (1)

Motti
Motti

Reputation: 114685

Could it be that the "Either you have entered" exists even when the login succeeds but isn't visible to the user? Perhaps it has hidden=true. Try to login successfully manually and then highlight that WebElement from the Object Repository. If it doesn't complain that the object does not exist the condition you're using for detecting successful login isn't correct.

Upvotes: 3

Related Questions