From f4c78bd50c9c2d284175866c025f244ddfe60b9a Mon Sep 17 00:00:00 2001 From: Anthon Pang Date: Mon, 4 Dec 2023 15:07:40 -0500 Subject: [PATCH] Element::css() works differently --- lib/WebDriver/Element.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/WebDriver/Element.php b/lib/WebDriver/Element.php index d4ecddf..937ab17 100644 --- a/lib/WebDriver/Element.php +++ b/lib/WebDriver/Element.php @@ -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. @@ -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'), @@ -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 *