-
Notifications
You must be signed in to change notification settings - Fork 96
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
Interacting with select controls #55
Comments
I'd look at the Select object in selenium and see how they handle it. I think it's part of the webdriver protocol. I don't believe they use any javascript shenanigans to accomplish the task. You probably don't have a strong need to emulate human interaction perfectly. Otherwise, you'd be testing the functionality of a select element. I don't think that's necessary. |
I've looked into their sources, what they do is simply a click on the option (without first clicking the select). I've modified my test, but it's still the same. What I also observe is that seemingly the onClick handler gets called, but not the onInput. With human interaction in the browser, both onClick and onInput gets called. |
I don't think it's a bad option. Once again, you are probably wanting to not test the html elment itself. |
Ah found the issue. Actually onInput is not valid in case of a select element, only for input type of elements. Changing to the onChange event works both for Webdriver and human interaction. Thank you. |
@idevai well, it depends on what HTML structure do you have. Sometimes, select widgets are implemented manually with lots of nested divs. In that case, you need to click on select, wait for a short time, then click on an element appeared in dropdown next. When dealing with native select fields, you may send them proper keys. The standard |
@igrishaev Both (click...) and (fill...) work great for selecting single elements. Is there a way to select more than one at a time, though? E.g. as if ctrl-clicking another element? edit -- looks like this functionality would be part of #103? |
@rgscherf right. Currently, I'm looking through actions in the Webdriver spec. Once I add them, there might be some high-level wrappers for custom action combos. |
What's the officially recommended way of doing this? I'd like to select a particular value from a HTML select element. As first try I could do this with first clicking the select and the clicking the option, however, my controls are not working the same way when it happens with human interaction (seemingly some javascript events are not fired properly?!)
The text was updated successfully, but these errors were encountered: