I have some buttons with an onclick
attribute and some that don't. I want to check if the specified element has the onclick
attribute. How can I do this?
getAttribute()
returns the attribute value when it has one. When it doesn't, it throws a RuntimeException and stops the test (even when I wrap it in a try/catch block).
$onclickValue = $this->getAttribute("$locator@onclick"); //works when the attribute exists