Code Duplication    Length = 6-7 lines in 3 locations

src/KeyboardTrait.php 3 locations

@@ 59-64 (lines=6) @@
56
   * @param string $modifier
57
   * @throws DriverException
58
   */
59
  public function keyDown($xpath, $char, $modifier = null) {
60
    $element = $this->findElement($xpath, 1);
61
    $key = $this->normalizeCharForKeyEvent($char);
62
    $modifier = $this->keyEventModifierControl($modifier);
63
    return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keydown", $key, $modifier);
64
  }
65
66
  /**
67
   * @param string $xpath
@@ 72-77 (lines=6) @@
69
   * @param string $modifier
70
   * @throws DriverException
71
   */
72
  public function keyPress($xpath, $char, $modifier = null) {
73
    $element = $this->findElement($xpath, 1);
74
    $key = $this->normalizeCharForKeyEvent($char);
75
    $modifier = $this->keyEventModifierControl($modifier);
76
    return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keypress", $key, $modifier);
77
  }
78
79
  /**
80
   * Pressed up specific keyboard key.
@@ 88-94 (lines=7) @@
85
   *
86
   * @throws DriverException                  When the operation cannot be done
87
   */
88
  public function keyUp($xpath, $char, $modifier = null) {
89
    $this->findElement($xpath, 1);
90
    $element = $this->findElement($xpath, 1);
91
    $key = $this->normalizeCharForKeyEvent($char);
92
    $modifier = $this->keyEventModifierControl($modifier);
93
    return $this->browser->keyEvent($element["page_id"], $element["ids"][0], "keyup", $key, $modifier);
94
  }
95
}
96