Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
selectOption speed with large select boxes #3003
The selectOption speed is particularly slow when there are large select boxes. I propose changing the order of the selectOption function to first search by value, instead of by visible text.
To give an idea on timing, I have a select box with 2700 options. If I run my test with the selectOption normally, it takes about 2.8 minutes. If I manually change the Codeception code not to execute the selectByVisibleText() webdriver function, it takes only 25 seconds.
It seems to be rare case for most of situation but yes, this should be optimized somehow for you as well. Changing order is not an option, as it is more natural to search by visible test inside a selectbox. Also what If there are values same as option text by they do not correspond. In this case user will have unexpected behavior.
Also I don't like boolean options in API - they are not verbose enough for scenarios.
// you can specify the exact manner of selecting option $I->selectOption('Age', ['value' => '21']); $I->selectOption('Age', ['text' => 'Adult']); // or use standard strict locators to match option elements by CSS/XPath $I->selectOption('Age', ['css' => '.important']);
And yes, if a regular string passed - behavior should not be changed.
@DavertMik you mentioned this strict locator:
But I haven't found this one in the webdriverBy: https://github.com/facebook/php-webdriver/blob/community/lib/WebDriverBy.php#L18-L21
It does exist?
Were can I found documentation about the Strict locators? I think we are missing a Guide about locators in codeception.com, all what I found are in this blog post http://codeception.com/05-01-2014/codeception-2.0-rc-strict-locators.html#.Vxi09JN97ow and a small reference at http://codeception.com/docs/03-AcceptanceTests#click
If you think we can add info about