Mercurial > hg > isophonics-drupal-site
comparison vendor/instaclick/php-webdriver/lib/WebDriver/Element.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 /** | |
3 * Copyright 2004-2017 Facebook. All Rights Reserved. | |
4 * | |
5 * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 * you may not use this file except in compliance with the License. | |
7 * You may obtain a copy of the License at | |
8 * | |
9 * http://www.apache.org/licenses/LICENSE-2.0 | |
10 * | |
11 * Unless required by applicable law or agreed to in writing, software | |
12 * distributed under the License is distributed on an "AS IS" BASIS, | |
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 * See the License for the specific language governing permissions and | |
15 * limitations under the License. | |
16 * | |
17 * @package WebDriver | |
18 * | |
19 * @author Justin Bishop <jubishop@gmail.com> | |
20 * @author Anthon Pang <apang@softwaredevelopment.ca> | |
21 * @author Fabrizio Branca <mail@fabrizio-branca.de> | |
22 */ | |
23 | |
24 namespace WebDriver; | |
25 | |
26 /** | |
27 * WebDriver\Element class | |
28 * | |
29 * @package WebDriver | |
30 * | |
31 * @method void click() Click on an element. | |
32 * @method void submit() Submit a FORM element. | |
33 * @method string text() Returns the visible text for the element. | |
34 * @method void postValue($json) Send a sequence of key strokes to an element. | |
35 * @method string name() Query for an element's tag name. | |
36 * @method void clear() Clear a TEXTAREA or text INPUT element's value. | |
37 * @method boolean selected() Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected. | |
38 * @method boolean enabled() Determine if an element is currently enabled. | |
39 * @method string attribute($attributeName) Get the value of an element's attribute. | |
40 * @method boolean equals($otherId) Test if two element IDs refer to the same DOM element. | |
41 * @method boolean displayed() Determine if an element is currently displayed. | |
42 * @method array location() Determine an element's location on the page. | |
43 * @method array location_in_view() Determine an element's location on the screen once it has been scrolled into view. | |
44 * @method array size() Determine an element's size in pixels. | |
45 * @method string css($propertyName) Query the value of an element's computed CSS property. | |
46 */ | |
47 final class Element extends Container | |
48 { | |
49 /** | |
50 * {@inheritdoc} | |
51 */ | |
52 protected function methods() | |
53 { | |
54 return array( | |
55 'click' => array('POST'), | |
56 'submit' => array('POST'), | |
57 'text' => array('GET'), | |
58 'value' => array('POST'), | |
59 'name' => array('GET'), | |
60 'clear' => array('POST'), | |
61 'selected' => array('GET'), | |
62 'enabled' => array('GET'), | |
63 'attribute' => array('GET'), | |
64 'equals' => array('GET'), | |
65 'displayed' => array('GET'), | |
66 'location' => array('GET'), | |
67 'location_in_view' => array('GET'), | |
68 'size' => array('GET'), | |
69 'css' => array('GET'), | |
70 ); | |
71 } | |
72 | |
73 /** | |
74 * {@inheritdoc} | |
75 */ | |
76 protected function obsoleteMethods() | |
77 { | |
78 return array( | |
79 'value' => array('GET'), | |
80 'selected' => array('POST'), | |
81 'toggle' => array('POST'), | |
82 'hover' => array('POST'), | |
83 'drag' => array('POST'), | |
84 ); | |
85 } | |
86 | |
87 /** | |
88 * Element ID | |
89 * | |
90 * @var string | |
91 */ | |
92 private $id; | |
93 | |
94 /** | |
95 * Constructor | |
96 * | |
97 * @param string $url URL | |
98 * @param string $id element ID | |
99 */ | |
100 public function __construct($url, $id) | |
101 { | |
102 parent::__construct($url); | |
103 | |
104 $this->id = $id; | |
105 } | |
106 | |
107 /** | |
108 * Get element ID | |
109 * | |
110 * @return string | |
111 */ | |
112 public function getID() | |
113 { | |
114 return $this->id; | |
115 } | |
116 | |
117 /** | |
118 * {@inheritdoc} | |
119 */ | |
120 protected function getElementPath($elementId) | |
121 { | |
122 return preg_replace(sprintf('/%s$/', $this->id), $elementId, $this->url); | |
123 } | |
124 } |