Skip to content

example.php fails: TypeError: form.submit is not a function #402

Closed

Description

@mirao

What are you trying to achieve? (Expected behavior)

Submit passes

What do you get instead? (Actual behavior)

Submit passes, but test fails

[22-Jan-2017 22:04:00 Europe/Berlin] PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\UnexpectedJavascriptException: TypeError: form.submit is not a function
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'mira-HP-ENVY-Notebook', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.0-34-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, firefoxOptions={args=[], profile=UEsDBBQACAgIAHqwNkoAAAAAAAAAAAAAAAAHAAAAdXNlci5qc51WTW/bMAy971cMOW3AIvRju2ynruuAAcU6LCh2FGSJttXIkqaPuPn3o2S7SRPHbndKbJMS+fj4yOjBUeugfLconGnxiXhWQv4vdUUaplrmgIBmhQKx+PC2ZMrD+y9v4s5TsIA21riQXGpgKtTdM0GjjeQz/hpCa9ya1CFYYmvp6+0yfbbM+6UCXYUaHS8+fXruNgTsgAn8ERCABxDfpfPhCmPhCtAtuHgYrmkwr0fKa2caoJ47aQN1UdMgm+RyeTZ+UWCFJwiHvtPXyngYz2awFqbVyjCBd2lWJWBr0/6pQa8QrYTUuLvFoGzw6TLaGMHUDPawCcYoT8A547jR3qh9uI/T97LSRiNqDTQFuFV+9OOn99Ba5jwsjV7mfCbjeWIReC/x3GCQPQ58RKRLTI1yx3w97aukXhNjQVN4DOA0U6n8r+ZcmYjwO+rxy1oohJMbfGacAxIgasTKI4EoB in /home/mira/workspace/selenium/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 122

More likely because the input element on that page has id="submit", see this post.

I used click() instead, it works for me:

$input = $driver->findElement(
    WebDriverBy::id('q')
);
$input->sendKeys('php');

# find submit
$submit = $driver->findElement(
    WebDriverBy::id("submit")
);
# and click
$submit->click();

How could the issue be reproduced? (Steps to reproduce)

  • Run the test example.php ($ php -f example.php)
  • Watch the command $input->sendKeys('php')->submit();

Details

  • Php-webdriver version: 1.3
  • PHP version: 7.0.13
  • Selenium server version: 3.0.1
  • Operating system: Ubuntu 16.10
  • Browser used + version: Firefox 50.1

Activity

  1. OndraM commented on Jan 23, 2017

    @OndraM
    Collaborator

    @mirao Thanks for the report! It appears to be a problem with Selenium itself. I reported it directly to the Selenium project, see SeleniumHQ/selenium#3398.

    So lets wait what they will think about it.

  2. mirao commented on Jan 23, 2017

    @mirao
    Author

    Thank you very much for reporting. I can confirm that it works well in Chrome.

  3. added a commit that references this issue on Mar 16, 2017
    89a6ce7
  4. OndraM commented on Mar 16, 2017

    @OndraM
    Collaborator

    I updated the example to do click instead of submit, until the Selenium bug is fixed (I pushed a PR there, see SeleniumHQ/selenium#3668 ).

  5. added a commit that references this issue on Mar 7, 2018
    eb1a2d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions