Not able to verify text after login with selenium Webdriver script -


i trying automate login functionality selenium webdriver using testng framework. want verify text after login hi [username@gmail.com].

this order in links present on page :

trackorder | notification | singnup | login 

my method of doing:
clicked on login (login window appears) , sign in. after login order in links present on page :

trackorder | notification | hi[username@gmail.com] 

for verifying text after login : extracting xpath of web element hi[username@gmail.com] , using gettext() method verify actual , expected value.

actual problem:
run script , logs in when extract text of web element printing signup. though login done why showing singup?

the reason printing signup maybe either xpath gave, not explicitly identifying username element , give element next notification element, or signup element text changing username text after login.

so, better create unique xpath element , wait time before using gettext() method.

thread.sleep() can used if text of element changing on login selenium execute method before change in text value.


Comments