The names of the fields used in drupalGet() and drupalPost() don't come out right.

Selenium gives the following phpUnit output:

    $this->type("edit-name", "Field Example Node");
    $this->type("edit-type", "field_example_node");
    $this->click("edit-submit");

and this module should turn that into:

$edit = array('name' => t('Field Example Node'), 'type' => 'field_example_node');
$this->drupalPost(NULL, $edit, t('Submit');

but instead it turns it into

    $edit = array (
      'edit-name' => 'Field Example Node',
      'edit-type' => 'field_example_node',
    );
    $this->drupalPost(NULL, $edit, t('edit-submit'));

It's using the id instead of the name field... which is what phpUnit is giving it. But anyway, it doesn't work.

Comments

rfay’s picture

Title: Incorrect conversion of "name" for drupalGet() and drupalPost() » Can't submit any form: Impossible conversion of "name" for drupalPost()

So Selenium IDE doesn't even notice/use the "value" attribute of a button.

There are only two things that drupalPost() can use: The value field of the button, or the name of the form.

So it would be impossible for Selenium to Simpletest to ever submit a form, right?

rfay’s picture

Title: Can't submit any form: Impossible conversion of "name" for drupalPost() » Can't submit any form: Impossible conversion of "value" for drupalPost()
boombatower’s picture

Well if we have the ID we can lookup the form ID or submit value.

rfay’s picture

Remember, we're doing a conversion after the fact, without a reference to the page. So if *all we have* is the ID, we're hosed, true? We don't have the page any more, just the phpunit code that Selenium output for us.

AFAICT, there is no way one could ever submit a form just using generated code through this process. Please tell me I'm wrong.

boombatower’s picture

We should be able to, since we have to see the page in order to submit it during run time. Just need to split up the drupalPost() into something like the following:

$this->drupalGet(URL);
$submit = $this->xpath('//submit[@id="' . $id . '"]');
$this->drupalPost(NULL, $edit, (string) $submit['value']);
rfay’s picture

Excellent! That will work.