How to add Negative Steps (If object doesnt not exist then step should be passed)

Could you please share some information about adding negative step.

For an example I want to make sure particular Button is not displayed on the screen. When I pass the xpath to “Check Element Exist in Browser” it will fail if the button doesn’t not exist, how to make it as negative step, I want to make this step as passed if the object doesn’t exist on the screen.

Hi Santosh,

Sorry for the late reply over Christmas. That operation doesn’t fail on a missing element; are you certain you’re not using “Get an Element from the Browser”?

Testing the below on bbc.co.uk, for example, correctly shows the fictitious locator as not existing, as we’d expect, without error.

element = '//some/locator' 
elementFound = web.exists ( target = element ) 
if elementFound {
	@name ( 'Log existence' ) console.write ( data = ^"Found element " + element^ ) 
	web.getelement ( target = element ) 
} 
else {
	@name ( 'Log non-existence' ) console.write ( data = ^"Have not found element " + element^ ) 
} 

It might be worth your while making sure you’re on a recent version as the web automation goes through rather more rapid feature improvement.

Cheers
Nik