jake_feyereisen jake_feyereisen - 1 year ago 115
PHP Question

Cannot call a command with multiple method arguments

Every time I attempt to use one of the basic PHPUnit Selenium assertions, the tests errors out and displays this message:

Exception: You cannot call a command with multiple method arguments.


On http://phpunit.de/manual/3.7/en/selenium.html, it shows the usage to be:

void assertElementValueEquals(string $locator, string $text)


Be when I call it with

$this->assertElementValueEquals( 'id=date_1_formatted', '2013-01-01' );


the test produces the above error every time even though this same format seems to be working for others such as in the question Using PHPUnit with Selenium, how can I test that an element contains exactly something?

Answer Source

assertElementValueEquals is not implemented in Selenium2TestCase. On your link it mentioned for SeleniumTestCase (Selenium RC version).

Moreover, you used correct structure with $this->byXPath like here https://github.com/sebastianbergmann/phpunit-selenium/blob/master/Tests/Selenium2TestCaseTest.php

Also you can use $this->byId():

$element = $this->byId('date_1_formatted');
$this->assertEquals('2013-01-01', $element->value());

P. S.: If you are familiar with Selenium IDE, you can try this command line tool.