#88 Detect button in form

open
nobody
Web tester (21)
5
2012-12-05
2012-12-05
doveraldo
No

I would like to be able to detect the existence of a button in a form. The button will not be a submit button, but will perform some javascript. I don't want to test the javascript, but since the page is dynamic based on the permission levels of the user I'd like to confirm the presence of the button in a unittest for the correct user levels

Currently I've tried the following asserts, but none of them work as only submit buttons are really remembered in the browser

$this->get("http://localhost/buttontest.php");
$this->assertField('button');
$this->assertClickable('button');
$this->assertField('button2');
$this->assertClickable('button2');

html page is something like this
<form name=test action=buttontest.php>
<input type=button name=button value=button onclick="alert('Hello World');">
<button type=button name=button2 value=button2 onclick="alert('Hello World 2');">
</form>

Unless I've missed something this doesn't seem to be possible (by design ?)

Discussion