From cef7fe88fe5384f6868741c69e629ac33f6e0099 Mon Sep 17 00:00:00 2001 From: JordiGiros Date: Thu, 18 Oct 2018 12:55:31 +0200 Subject: [PATCH 1/5] Add setAutocompleteValue method --- src/Driver/CoreDriver.php | 8 ++++++++ src/Driver/DriverInterface.php | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Driver/CoreDriver.php b/src/Driver/CoreDriver.php index 9b4c04e43..b8783903e 100644 --- a/src/Driver/CoreDriver.php +++ b/src/Driver/CoreDriver.php @@ -177,6 +177,14 @@ public function setValue($xpath, $value) throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this); } + /** + * {@inheritdoc} + */ + public function setAutocompleteValue($xpath, $value) + { + throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this); + } + /** * {@inheritdoc} */ diff --git a/src/Driver/DriverInterface.php b/src/Driver/DriverInterface.php index 0880960c7..cf73b10e8 100644 --- a/src/Driver/DriverInterface.php +++ b/src/Driver/DriverInterface.php @@ -365,6 +365,19 @@ public function getValue($xpath); */ public function setValue($xpath, $value); + /** + * Sets autocomplete element's value by it's XPath query. + * + * @param string $xpath + * @param string|bool|array $value + * + * @throws UnsupportedDriverActionException When operation not supported by the driver + * @throws DriverException When the operation cannot be done + * + * @see \Behat\Mink\Element\NodeElement::setAutocompleteValue + */ + public function setAutocompleteValue($xpath, $value); + /** * Checks checkbox by it's XPath query. * From 3089af2e0a3808889dc80c9a093d73a46e36b631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Gir=C3=B3s?= Date: Thu, 18 Oct 2018 14:07:49 +0200 Subject: [PATCH 2/5] Update CoreDriver.php --- src/Driver/CoreDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Driver/CoreDriver.php b/src/Driver/CoreDriver.php index b8783903e..8d6dba7a1 100644 --- a/src/Driver/CoreDriver.php +++ b/src/Driver/CoreDriver.php @@ -182,7 +182,7 @@ public function setValue($xpath, $value) */ public function setAutocompleteValue($xpath, $value) { - throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this); + throw new UnsupportedDriverActionException('Setting the auto-complete field value is not supported by %s', $this); } /** From 9e02043d12e198796ed2ba4d7f388bd76d797921 Mon Sep 17 00:00:00 2001 From: JordiGiros Date: Thu, 18 Oct 2018 15:57:18 +0200 Subject: [PATCH 3/5] Change method name --- .idea/Mink.iml | 11 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/php.xml | 4 + .idea/vcs.xml | 6 + .idea/workspace.xml | 218 +++++++++++++++++++++++++++++++++ src/Driver/CoreDriver.php | 2 +- src/Driver/DriverInterface.php | 4 +- 8 files changed, 256 insertions(+), 3 deletions(-) create mode 100644 .idea/Mink.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/Mink.iml b/.idea/Mink.iml new file mode 100644 index 000000000..d77b49d9f --- /dev/null +++ b/.idea/Mink.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..28a804d89 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..05a131a78 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 000000000..015149591 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..c963bccaa --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + $PROJECT_DIR$/composer.json + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + setVal + type + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - 1539860043086 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 637fdb78ad056ed2cb36be55c2738a37c059caa1 Mon Sep 17 00:00:00 2001 From: JordiGiros Date: Thu, 18 Oct 2018 16:36:04 +0200 Subject: [PATCH 5/5] Add NodeElement method --- src/Element/NodeElement.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Element/NodeElement.php b/src/Element/NodeElement.php index bbb857332..4fb52a50e 100644 --- a/src/Element/NodeElement.php +++ b/src/Element/NodeElement.php @@ -105,6 +105,18 @@ public function setValue($value) $this->getDriver()->setValue($this->getXpath(), $value); } + /** + * Sends keys to an input element + * + * Calling this method on other elements than form fields is not allowed. + * + * @param string|bool|array $value + */ + public function sendKeys($value) + { + $this->getDriver()->sendKeys($this->getXpath(), $value); + } + /** * Checks whether element has attribute with specified name. *