Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertSelectOptions errors on empty options #357

Open
mc-murphy83 opened this issue Dec 3, 2015 · 2 comments
Open

assertSelectOptions errors on empty options #357

mc-murphy83 opened this issue Dec 3, 2015 · 2 comments

Comments

@mc-murphy83
Copy link

assertSelectOptions gives an error when trying to check for Option-Fields with neither value nor innerHTML set.
example:

<select id="payment_method">
<option value=""></option>
<option value="mastercard">MasterCard</option>
<option value="visa">VISA</option>
</select>

When using the following Selenese (which works fine in the SeleniumIDE)

 <tr>
 <td>assertSelectOptions</td>
 <td>id=payment_method</td>
 <td>,mastercard,visa</td>
 </tr>

Results in the following error:

Argument #2 (No Value) of PHPUnit_Framework_Assert::assertRegExp() must be a string
Caused by
PHPUnit_Framework_Exception: Argument #2 (No Value) of PHPUnit_Framework_Assert::assertRegExp() must be a string

I think this is due to the empty strings that are used for matching.

@mc-murphy83
Copy link
Author

did some more research - it currently looks like that the function "assertSelectOptions" hands in an array instead of a string into PHPUnit_Framework_Assert::assertRegExp() - which in turn causes the Failure, as an array can not easily be transformed into a suitable string respresentation that would allow for comparision.
It looks like the Interface / return value used has changed.

@giorgiosironi
Copy link
Owner

This function is dynamically generated deep down the Selenium 1 driver (that's very old code). I would workaround this by caling getSelectOptions() and asserting the result yourself, but I don't know how to write this in Selenese.
If you want to write a Pull Request fixing the problem, what you're looking for is PHPUnit_SeleniumTestCase_Driver::autoGenerateCommands() and PHPUnit_SeleniumTestCase_Driver::assertCommand() methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants