How to set attribute of an element using phpunit-selenium

I would like to do something like:

// pseudocode
$this->byCssSelector('p')->setAttribute('attributename', 'attributevalue');

      

How can I do this in phpunit-selenium ?

+3


source to share


1 answer


You need to use execute()

javascript to run and set the attribute with setAttribute()

:



$this->execute(array(
    'script' => "document.getElementById('my_id').setAttribute('name', 'value');", 
    'args' => array()
));

      

+5


source







All Articles