UPDATE: NO NEED FOR AN EXTENSION:
I decided to test this out on yahoo.com:
storeElementPresent id=search-button x
click javascript{if(storedVars['x'] == true){this.browserbot.findElement('id=search-button').click();}}
Give it a try on your own :)
I recommend utilizing the goto_sel_ide
browser tool, which can be found online. The use of storeElementPresent
is also quite handy. It helps in storing a boolean value to determine if a specific element exists or not. Check out the sample code below:
storeElementPresent checkbox x
gotoIf ${x}==true executeIfXisTrue
gotoIf ${x}==false executeIfXisFalse
label executeIfXisTrue //execute this block if "checkbox" element exists
click yourElement
goto afterCheckbox
label executeIfXisFalse //execute this block if "checkbox" element does NOT exist
//todo, implement action for when element is not present
goto afterCheckbox
label afterCheckbox