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 5dd9678 commit fff9a8e
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 @@ -42,7 +42,6 @@
* @method array location() Determine an element's location on the page.
* @method array location_in_view() Determine an element's location on the screen once it has been scrolled into view.
* @method array size() Determine an element's size in pixels.
* @method string css($propertyName) Query the value of an element's computed CSS property.
*/
final class Element extends Container
{
Expand All @@ -66,7 +65,6 @@ protected function methods()
'location' => array('GET'),
'location_in_view' => array('GET'),
'size' => array('GET'),
'css' => array('GET'),
);
}

Expand Down Expand Up @@ -114,6 +112,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'];
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit fff9a8e

Please sign in to comment.