-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
issue selecting an item from dropdown list (select2) #5135
Comments
What is Select2? |
this one: https://gist.github.com/tortuetorche/412fbac4f17db5e78e79 Ps: all others suggestion to select option from this kind of dropdown list are welcome :) |
Are you using code from the top or the bottom of the gist? |
ok thanks naktibalda !! have you any other idea to make codeception select this option !! |
Hey you can use "selectOption" for select option value. before this script you will have to use "wait" function. |
Current guideline for dealing with custom selectboxes:
|
If you are using Select2, implementation of #5135 (comment) is: public function selectSelect2Options(string $selector, array $options)
{
foreach ($options as $option) {
$this->seeElementInDOM(Locator::combine($selector . ' option[value=' . $option . ']', '#not-exist-7985-anything'));
}
$optionsAsJs = count($options) > 1 ? ('"' . implode('", "', $options) . '"') : "'$options[0]'";
$jsStr = "var sel = $('$selector');
sel.val([$optionsAsJs]);
sel.trigger('change');";
$this->executeJS($jsStr);
} Also this method will throw error if any option is not found. Example usage: $I->selectSelect2Options('#states', ['GJ', 'MH', 'KL']); |
What are you trying to achieve?
I want to select an option from select2
What do you get instead?
I used the select2 v3.5 but didn't get any succes try
I've tried this code and the one commented also without any result
Details
here is my select it's dynamic one with search filed
and down of the html page I had this
please guys I need your help I'm blocede now for there days and thanks in advance
The text was updated successfully, but these errors were encountered: