Conditions | 2 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public static function elementExists($selector, $by = 'byId') |
||
12 | { |
||
13 | return new WebDriverExpectedCondition( |
||
14 | function ($driver) use ($selector, $by) { |
||
15 | try { |
||
16 | $element = $driver->$by($selector); |
||
17 | return $element instanceof WebDriverElement; |
||
18 | } catch (\Exception $e) { |
||
19 | // No need to do anything. No element == exception. |
||
20 | } |
||
21 | return false; |
||
22 | } |
||
23 | ); |
||
24 | } |
||
25 | |||
40 | } |