Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit c6f9890

Browse files
committed
Merge pull request #128 from okrad/master
Wrong reference in WebDriverExpectedCondition, possible encode error
2 parents 8bde8d5 + d9ba704 commit c6f9890

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/WebDriverExpectedCondition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,15 @@ public static function elementSelectionStateToBe(
352352
if ($element_or_by instanceof WebDriverElement) {
353353
return new WebDriverExpectedCondition(
354354
function ($driver) use ($element_or_by, $selected) {
355-
return $element_or_by->isSelected === $selected;
355+
return $element_or_by->isSelected() === $selected;
356356
}
357357
);
358358
} else if ($element_or_by instanceof WebDriverBy) {
359359
return new WebDriverExpectedCondition(
360360
function ($driver) use ($element_or_by, $selected) {
361361
try {
362362
$element = $driver->findElement($element_or_by);
363-
return $element->isSelected === $selected;
363+
return $element->isSelected() === $selected;
364364
} catch (StaleElementReferenceException $e) {
365365
return null;
366366
}

lib/WebDriverKeys.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ class WebDriverKeys {
9090
* @return array
9191
*/
9292
public static function encode($keys) {
93+
94+
if(is_numeric($keys))
95+
$keys = '' . $keys;
96+
9397
if (is_string($keys)) {
9498
$keys = array($keys);
9599
}
@@ -100,7 +104,7 @@ public static function encode($keys) {
100104
// handle modified keys
101105
$key = implode('', $key).self::NULL;
102106
}
103-
$encoded[] = (string)$key;
107+
$encoded = array_merge($encoded, str_split((string)$key));
104108
}
105109

106110
return $encoded;

0 commit comments

Comments
 (0)