Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pfrenssen/0bf4137fb3521334e671d61b3e0f3dff to your computer and use it in GitHub Desktop.

Select an option

Save pfrenssen/0bf4137fb3521334e671d61b3e0f3dff to your computer and use it in GitHub Desktop.

Revisions

  1. pfrenssen created this gist Jul 22, 2018.
    75 changes: 75 additions & 0 deletions mink-selenium2-driver-revert-244.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    commit a4d0d2dd43d09b3d44031ce43165d4fad4078018
    Author: Pieter Frenssen <pieter@frenssen.be>
    Date: Sun Jul 22 15:42:02 2018 +0300

    Revert "Fixed unwanted trailing tab in chrome 53 (#244)"

    This reverts commit 67c5b8a20274c53ec2f85fabda7005a6ac2dd1b9.

    diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php
    index cabdb60..0d54042 100755
    --- a/src/Selenium2Driver.php
    +++ b/src/Selenium2Driver.php
    @@ -679,11 +679,10 @@ JS;
    $existingValueLength = strlen($element->attribute('value'));
    // Add the TAB key to ensure we unfocus the field as browsers are triggering the change event only
    // after leaving the field.
    - $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value;
    + $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value . Key::TAB;
    }

    $element->postValue(array('value' => array($value)));
    - $this->trigger($xpath, 'change');
    }

    /**
    @@ -837,7 +836,8 @@ JS;
    */
    public function focus($xpath)
    {
    - $this->trigger($xpath, 'focus');
    + $script = 'Syn.trigger("focus", {}, {{ELEMENT}})';
    + $this->withSyn()->executeJsOnXpath($xpath, $script);
    }

    /**
    @@ -845,7 +845,8 @@ JS;
    */
    public function blur($xpath)
    {
    - $this->trigger($xpath, 'blur');
    + $script = 'Syn.trigger("blur", {}, {{ELEMENT}})';
    + $this->withSyn()->executeJsOnXpath($xpath, $script);
    }

    /**
    @@ -854,7 +855,8 @@ JS;
    public function keyPress($xpath, $char, $modifier = null)
    {
    $options = self::charToOptions($char, $modifier);
    - $this->trigger($xpath, 'keypress', $options);
    + $script = "Syn.trigger('keypress', $options, {{ELEMENT}})";
    + $this->withSyn()->executeJsOnXpath($xpath, $script);
    }

    /**
    @@ -863,7 +865,8 @@ JS;
    public function keyDown($xpath, $char, $modifier = null)
    {
    $options = self::charToOptions($char, $modifier);
    - $this->trigger($xpath, 'keydown', $options);
    + $script = "Syn.trigger('keydown', $options, {{ELEMENT}})";
    + $this->withSyn()->executeJsOnXpath($xpath, $script);
    }

    /**
    @@ -872,7 +875,8 @@ JS;
    public function keyUp($xpath, $char, $modifier = null)
    {
    $options = self::charToOptions($char, $modifier);
    - $this->trigger($xpath, 'keyup', $options);
    + $script = "Syn.trigger('keyup', $options, {{ELEMENT}})";
    + $this->withSyn()->executeJsOnXpath($xpath, $script);
    }

    /**