Skip to content

Form submission problem #7

Description

@dogproblems

Hi, I haven't been able to use the click methods to submit a form successfully. Here's a simple test; if I serve this page on my localhost:

`

<title>FormTest</title> Content: " . $_POST['content'] . "

"; } ?> Submit ` then hit it using browserext, by running this script via CLI:

`

!/usr/bin/env php

load("http://localhost/formtest.php"); $inp = $br->elements("//input"); foreach($inp as $input) { if($input->attr('name') == 'content') { if ($br->fill($input->getXPath(), 'Hello World')) echo "Fill OK\n"; } } $inp = $br->elements("//button"); foreach($inp as $input) { if($input->attr('class') == 'submit') { if($input->click()) echo "Click OK\n"; } } $br->wait(8); ?>

`

The fill works, I can see the text appear in the phpbrowser window on the Ubuntu desktop, and if I manually click Submit during the final wait, the form is submitted correctly, but I can't get the click call to work. It returns true, but the form is not submitted.

Click seems to work for <a href="..."> elements but not <button>. I noticed that calling click() in php ultimately calls PhpWebView::click2(), and there is an unused PhpWebView::click() function. I tried adding code to use this instead for <button>, but this was not effective. Any ideas?

EDIT: Looks like there is something strange happening with QWebElement::evaluateJavaScript. I enabled console output to do some debugging, and all I can see is alerts etc.. Even if I try to run garbage as a JS string, no errors are displayed. PhpWebPage::javaScriptConsoleMessage doesn't seem to even get called.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions