Selenium Assert questions - Java -


how you?

i'm starting selenium, , i'm trying hard deal "asserttrue (boolean condition)", there's wrong.

i need junit gets green(ok) if access 1 page, , want red(nok) if it's not possible access.

but got green, every single time!

for example: if access payment page it's ok (i assert there's buy button sure payment page) if try access without being logged system displays error message (if not find buy button won't in payment page)

so here's i'm trying in end of public boolean method:

if(buybutton.isdisplayed()){     return true; } else {     return false; } 

so in test class i'm trying assert:

shoes i'm buying, , shoeslink.com can find it. put 2 variables there because there's if - if user wants buy shoes selenium expect elements, if shirt selenium expect others. guess doesn't matter, because assert defined code put above, right? , below assertcode i'm talking about:

asserttrue(buy.accessproduct("**shoes**", "**shoeslink.com**")); 

well, if guys have logic or way it, that's need now: successfull test if find element or error test if don't.

thank you!

i think wrongly wrote parameters of asserttrue:

asserttrue("error message in case of false", buy.accessproduct("**shoes**", "**shoeslink.com**")); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -