Dealing with False positive

How do we deal with a situation - for web testing where the element (hyperlink) is clickable and action is ‘Click’
But on running the test case - the script does not actually ‘click’ the element - but the script is passed
Seems like a false positive
If the element was successfully clicked - it would have opened the next screen
I have tried ‘Click’, ‘Enhanced Click’
All give the same outcome - passed successfully but not actually clicking the element

Welcome to the forum @anishas, Please review this link so someone can help you with your question. [TIP] How To Help Us Help You!

1 Like

Hi @anishas,

You could try clicking on the element(s) using a Javascript Keyword instead (see this post):

Or you could try this:
When using ‘’ or ‘WebUI.enhancedClick’ you should first use ‘WebUI.waitForElementPresent’ , ‘WebUI.waitForElementVisible’ or WebUI.delay()

For example:

WebUI.waitForElementPresent(findTestObject('ObjectPath/SubmitBtn'), 30) //waits up-to 30 seconds


WebUI.waitForElementVisible(findTestObject('ObjectPath/SubmitBtn'), 30)


WebUI.delay(5) //Not the best practice but when all else fails.

Using JavaScript to do a click, especially when there are perfectly good built-in keywords for that, is a test code smell.

Also, hard-coded delay() or sleep() is also code smell.

Those first two code snippets are the way to go here.

That’s quite an assertion you’re making. Perhaps you believe webdrivers are the only valid means of responding to test scripts – which is evidently not true. How do you think Cypress does it? And Playwright? (to name just two). How do you ensure that complex onchange handlers are called correctly for tricky/quirky (questionable?) built frameworks?

Native, in-browser JavaScript calls are not the enemy. Neither do they smell.

I suppose, you have a good sence of humor…

My response would be to ask what you are testing and what are you you trying to validate? If your test ends after you click something then perhaps you need an additional assertion to check that you are now on the right acreen? You also need to make the click less flaky, as others have given suggestions for

Bingo. In a nutshell, test the outcomes of actions whenever possible. One surefire way to help in the ongoing battle with flakiness.