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?
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.
精彩评论