Nearsoft\SeleniumClient\WebElement::setAttribute PHP Method

setAttribute() public method

Sets element's specified attribute's value
public setAttribute ( string $attributeName, string $value )
$attributeName string The element's attribute name
$value string The value to set the attribute
    public function setAttribute($attributeName, $value)
    {
        $key = $attributeName == 'text' ? 'var k=typeof arguments[0].textContent!="undefined"?"textContent":"innerText"' : sprintf('var k="%s"', addslashes($attributeName));
        $script = sprintf("{$key};arguments[0][k]='%s';return true", addslashes($value));
        $this->_driver->executeScript($script, array(array('ELEMENT' => $this->_elementId)));
        return $this;
    }