Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement type() method to use Syn.type. Fixed issue with key{press|d… #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,21 @@ public function keyUp($xpath, $char, $modifier = null)
$this->withSyn()->executeJsOnXpath($xpath, $script);
}

/**
* Simulates keyboard typing with Syn.type().
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mink drivers are abstractions. So the phpdoc of methods should absolutely not describe them by talking about their internal implementation.

and indeed, as @aik099 said, this method won't be accepted if it is not properly added to the Mink API (btw, people are not expected to use the driver directly)

* See: https://github.com/bitovi/syn/blob/master/src/key.js#L133
*
* @param string $xpath
* @param string $text example: "Firstname\tLast\[email protected]\r"
*
*/
public function type($xpath, $text)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method can be useful, but needs to be added to:

  1. driver test suite
  2. driver interface
  3. at least to 2 other drivers

{
$text = json_encode($text);
$script = "Syn.type({{ELEMENT}}, $text)";
$this->withSyn()->executeJsOnXpath($xpath, $script);
}

/**
* {@inheritdoc}
*/
Expand Down