giorgiosironi / phpunit-selenium

Selenium RC integration for PHPUnit
http://www.phpunit.de/
Other
602 stars 271 forks source link

How to test autocomplete #371

Open wrossier opened 8 years ago

wrossier commented 8 years ago

Hi,

I'd like to make a test with an autocomplete (Jquery, https://jqueryui.com/autocomplete/) field, I can't access the hidden field attached to it.

I searched on Google, without success :(

Do you have any examples for testing that ?

Below, our test code: ` function testTest(){ $this->url("/"); $input = $this->byLinkText("Développement / programmation"); $input->click();

    $input = $this->byId("js_header_autocomplete_activity");
    $input->clear();
    $input->value("Développement / programmation");

}

`

Regards, William

wrossier commented 8 years ago

I found the problem, my code doesn't work on Firefox but on chrome, below ma configuration:

public static $browsers = array( // run FF15 on Windows 8 on Sauce // array( // 'browserName' => 'firefox', // 'desiredCapabilities' => array( // 'version' => '44', // 'platform' => 'Windows 2012', // ) // ), // run Chrome on Linux on Sauce array( 'browserName' => 'chrome', 'desiredCapabilities' => array( 'platform' => 'Windows 2012' ) ), );

When I use the comment configuration (with firefox) it doesn't work and with the other configuration it's ok.

I don't know why ? weird

William

giorgiosironi commented 8 years ago

The mantra of Selenium is to represent what a real user does, so afaik hidden fields and in general invisible elements must not be interacted with.

Moreover, differences between browsers are out of the scope of this project, since we pass commands to the Selenium server in the same way.