Skip to content

Commit

Permalink
Element::css() works differently
Browse files Browse the repository at this point in the history
  • Loading branch information
robocoder committed Dec 4, 2023
1 parent a5821f7 commit f4c78bd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/WebDriver/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* @method string attribute($attributeName) Get the value of an element's attribute.
* @method void clear() Clear a TEXTAREA or text INPUT element's value.
* @method void click() Click on an element.
* @method string css($propertyName) Query the value of an element's computed CSS property.
* @method boolean displayed() Determine if an element is currently displayed.
* @method boolean enabled() Determine if an element is currently enabled.
* @method boolean equals($otherId) Test if two element IDs refer to the same DOM element.
Expand Down Expand Up @@ -55,7 +54,6 @@ protected function methods()
'attribute' => array('GET'),
'clear' => array('POST'),
'click' => array('POST'),
'css' => array('GET'),
'enabled' => array('GET'),
'name' => array('GET'),
'property' => array('GET'),
Expand Down Expand Up @@ -115,6 +113,20 @@ public function getID()
return $this->id;
}

/**
* Query the value of an element’s computed CSS property: /session/:sessionId/element/:id/css/:propertyName
*
* @param string $propertyName
*
* @return mixed
*/
public function css($propertyName)
{
$result = $this->curl('GET', "/css/$propertyName");

return $result['value'];
}

/**
* Get element shadow root: /session/:sessionId/element/:elementId/shadow
*
Expand Down

0 comments on commit f4c78bd

Please sign in to comment.