substr in PHP has a funny side-effect such that:
substr("OK,",3) === false
Which causes errors. Fix is as follows:
private function getString($verb, $args = array())
{
try {
$result = $this->doCommand($verb, $args);
} catch (SeleniumException $e) {
return $e;
}
if (strlen($result) === 3) return "";
return substr($result, 3);
}
Note that you could also fix
http://jira.openqa.org/browse/SRC-425
as well as follows:
private function getString($verb, $args = array())
{
$result = $this->doCommand($verb, $args);
if (strlen($result) === 3) return "";
return substr($result, 3);
}
Letting the exception be passed up the chain to be handled. I'd also recommend letting this be public to enable overriding it.
public function assertValue($locator, $value)
{
$site_value = $this->getValue($locator);
if ($site_value !== $value) {
$this->failed("Element $locator does not match expected value \"$value\" (".gettype($value)."): \"$site_value\" (".gettype($site_value).")");
}
}
when checking inputs which should be empty.