1 | <?php |
||
17 | class RawPageContext extends RawDrupalContext |
||
18 | { |
||
19 | /** |
||
20 | * @var NodeElement |
||
21 | */ |
||
22 | private static $workingElement; |
||
23 | |||
24 | /** |
||
25 | * @return NodeElement |
||
26 | */ |
||
27 | public function getWorkingElement() |
||
35 | |||
36 | /** |
||
37 | * @param NodeElement $element |
||
38 | */ |
||
39 | public function setWorkingElement(NodeElement $element) |
||
43 | |||
44 | public function unsetWorkingElement() |
||
48 | |||
49 | /** |
||
50 | * Find all elements matching CSS selector, name of region from config or inaccurate text. |
||
51 | * |
||
52 | * @param string $selector |
||
53 | * CSS selector, region name or inaccurate text. |
||
54 | * |
||
55 | * @return NodeElement[] |
||
56 | * List of nodes. |
||
57 | */ |
||
58 | public function findAll($selector) |
||
72 | |||
73 | /** |
||
74 | * @param string $selector |
||
75 | * |
||
76 | * @return NodeElement |
||
77 | */ |
||
78 | public function findByCss($selector) |
||
83 | |||
84 | /** |
||
85 | * @param string $selector |
||
86 | * |
||
87 | * @return NodeElement|null |
||
88 | */ |
||
89 | public function findField($selector) |
||
108 | |||
109 | /** |
||
110 | * @param string $selector |
||
111 | * |
||
112 | * @return NodeElement |
||
113 | */ |
||
114 | public function findButton($selector) |
||
121 | |||
122 | /** |
||
123 | * @param string $text |
||
124 | * |
||
125 | * @return NodeElement|null |
||
126 | */ |
||
127 | public function findByText($text) |
||
131 | |||
132 | /** |
||
133 | * @param string $locator |
||
134 | * Element locator. Can be inaccurate text, inaccurate field label, CSS selector or region name. |
||
135 | * |
||
136 | * @throws NoSuchElement |
||
137 | * |
||
138 | * @return NodeElement |
||
139 | */ |
||
140 | public function findElement($locator) |
||
147 | |||
148 | /** |
||
149 | * Find all field labels by text. |
||
150 | * |
||
151 | * @param string $text |
||
152 | * Label text. |
||
153 | * |
||
154 | * @return NodeElement[] |
||
155 | */ |
||
156 | public function findLabels($text) |
||
166 | |||
167 | /** |
||
168 | * @return NodeElement |
||
169 | */ |
||
170 | public function getBodyElement() |
||
174 | |||
175 | /** |
||
176 | * @param string $selector |
||
177 | * Element selector. |
||
178 | * @param mixed $element |
||
179 | * Existing element or null. |
||
180 | * |
||
181 | * @throws NoSuchElement |
||
182 | */ |
||
183 | public function throwNoSuchElementException($selector, $element) |
||
189 | |||
190 | /** |
||
191 | * @param string $locator |
||
192 | * @param string $selector |
||
193 | * |
||
194 | * @throws \RuntimeException |
||
195 | * @throws NoSuchElement |
||
196 | * |
||
197 | * @return NodeElement |
||
198 | */ |
||
199 | public function element($locator, $selector) |
||
219 | |||
220 | /** |
||
221 | * @param string $query |
||
222 | * @param string $text |
||
223 | * @param NodeElement $parent |
||
224 | * |
||
225 | * @return XPath\InaccurateText |
||
226 | */ |
||
227 | private function inaccurateText($query, $text, NodeElement $parent = null) |
||
231 | |||
232 | /** |
||
233 | * @param string $selector |
||
234 | * |
||
235 | * @return string |
||
236 | */ |
||
237 | private function computeSelectorType($selector) |
||
241 | } |
||
242 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: