Skip to content

Commit 4ac0709

Browse files
committed
Element::attribute() works differently
1 parent 520d22b commit 4ac0709

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/WebDriver/Element.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
* @method void clear() Clear a TEXTAREA or text INPUT element's value.
3737
* @method boolean selected() Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected.
3838
* @method boolean enabled() Determine if an element is currently enabled.
39-
* @method string attribute($attributeName) Get the value of an element's attribute.
4039
* @method boolean equals($otherId) Test if two element IDs refer to the same DOM element.
4140
* @method boolean displayed() Determine if an element is currently displayed.
4241
* @method array location() Determine an element's location on the page.
@@ -59,7 +58,6 @@ protected function methods()
5958
'clear' => array('POST'),
6059
'selected' => array('GET'),
6160
'enabled' => array('GET'),
62-
'attribute' => array('GET'),
6361
'equals' => array('GET'),
6462
'displayed' => array('GET'),
6563
'location' => array('GET'),
@@ -112,6 +110,20 @@ public function getID()
112110
return $this->id;
113111
}
114112

113+
/**
114+
* Get the value of an element's attribute: /session/:sessionId/element/:id/attribute/:name
115+
*
116+
* @param string name
117+
*
118+
* @return mixed
119+
*/
120+
public function attribute($name)
121+
{
122+
$result = $this->curl('GET', "/attribute/$name");
123+
124+
return $result['value'];
125+
}
126+
115127
/**
116128
* Query the value of an element’s computed CSS property: /session/:sessionId/element/:id/css/:propertyName
117129
*

0 commit comments

Comments
 (0)