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

Shift+Click on <option> elements of <select multiple="multiple"> does not select multiple options #645

Closed
2 tasks done
jimevans opened this issue Apr 12, 2017 · 5 comments
Assignees

Comments

@jimevans
Copy link

In order to help us efficiently investigate your issue, please provide the following information:

Firefox Version

55.0a1 (2017-04-12) (32-bit)
geckodriver as of commit 15345b6

Platform

Windows

Steps to reproduce

Execute the following code using the Selenium .NET bindings (exact W3C WebDriver protocol commands are included as comments):

FirefoxOptions options = new FirefoxOptions();
options.LogLevel = FirefoxDriverLogLevel.Trace;
options.BrowserExecutableLocation = @"C:\Program Files (x86)\Nightly\firefox.exe";

// POST /session
// command body:
// {
//     "capabilities": {
//         "alwaysMatch" : {
//             "browserName": "firefox",
//             "acceptInsecureCerts": true,
//             "moz:firefoxOptions": {
//                 "binary": "C:\Program Files (x86)\Nightly\firefox.exe",
//                 "log": {
//                     "level": "trace"
//                 }
//             }
//         }
//    }
// }
IWebDriver driver = new FirefoxDriver(options);

// POST /session/{sessionId}/url
// Request Body: { "url": "<url to the hosted HTML file, provided below>" }
driver.Url = "<url to HTML file, provided below>";

// POST /session/{sessionId}/element
// Request Body: { "using": "css selector", "value": "option" }
ReadOnlyCollection<IWebElement> elementOptions = driver.FindElements(By.CssSelector("option"));

Actions actionBuider = new Actions(driver);
IAction selectThreeOptions = actionBuider.Click(elementOptions[1])
    .KeyDown(Keys.Shift)
    .Click(elementOptions[2])
    .Click(elementOptions[3])
    .KeyUp(Keys.Shift).Build();

// POST /session/{sessionId}/actions
// See trace log for full JSON request body.
selectThreeOptions.Perform();

Expect: The <select> element should have three <option> elements selected.

Result: Only the last <option> element is selected.

I believe this may be a larger problem with multiple input devices in the same actions end point payload. We need to make sure Control+Click and friends work too.

  • A minimal HTML file (or files) that can be used to reproduce the issue
<!DOCTYPE html>
<html>
<head>
    <title>Testing Typing into body</title>
</head>

<body>
  <form action="" id="on-form" name="multichoice">
    <select name="multi" id="multi" multiple="multiple">
        <option selected="selected" label="emmental">Emmental</option>
        <option label="roquefort" >Roquefort</option>
        <option label="parmigiano">Parmigiano</option>
        <option label="cheddar">Cheddar</option>
    </select>
  </form>
</body>
</html>
  • A trace level log from a geckodriver session that demonstrates the problem using the minimal example file.
1492037585251   geckodriver     INFO    Listening on 127.0.0.1:56913
1492037587246   geckodriver::marionette INFO    Starting browser \\?\C:\Program Files (x86)\Nightly\firefox.exe with args ["-marionette"]
1492037589366   geckodriver::marionette TRACE     connection attempt 0/600
1492037609336   geckodriver::marionette DEBUG   Connected to Marionette on localhost:56961
1492037609441   geckodriver::marionette TRACE   ← {"applicationType":"gecko","marionetteProtocol":3}
1492037609653   geckodriver::marionette TRACE   → 269:[0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox","platform":"ANY","specificationLevel":1,"version":""}},"platform":"ANY","specificationLevel":1,"version":""}]
1492037609838   geckodriver::marionette TRACE   ← [1,1,null,{"sessionId":"878fe0df-2131-43b3-b649-39844d38c895","capabilities":{"browserName":"firefox","browserVersion":"55.0a1","platformName":"windows_nt","platformVersion":"10.0","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":1,"moz:processID":18056,"moz:profile":"C:\\Users\\seatt\\AppData\\Local\\Temp\\rust_mozprofile.uPHFGGxbC4WQ","moz:accessibilityChecks":false}}]
1492037609846   webdriver::server       DEBUG   Returning status Ok
1492037609855   webdriver::server       DEBUG   Returning body {"value": {"sessionId":"878fe0df-2131-43b3-b649-39844d38c895","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"55.0a1","moz:accessibilityChecks":false,"moz:processID":18056,"moz:profile":"C:\\Users\\seatt\\AppData\\Local\\Temp\\rust_mozprofile.uPHFGGxbC4WQ","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"10.0","rotatable":false,"specificationLevel":1,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
1492037609903   webdriver::server       DEBUG   Got request POST AbsolutePath("/session/878fe0df-2131-43b3-b649-39844d38c895/url")
1492037609920   webdriver::command      DEBUG   Got request body {"url":"http://localhost:2310/common/multiActionPage.html"}
1492037609936   geckodriver::marionette TRACE   → 71:[0,2,"get",{"url":"http://localhost:2310/common/multiActionPage.html"}]
1492037610552   geckodriver::marionette TRACE   ← [1,2,null,{}]
1492037610613   webdriver::server       DEBUG   Returning status Ok
1492037610615   webdriver::server       DEBUG   Returning body {"value": {}}
1492037610618   webdriver::server       DEBUG   Got request POST AbsolutePath("/session/878fe0df-2131-43b3-b649-39844d38c895/elements")
1492037610619   webdriver::command      DEBUG   Got request body {"using":"css selector","value":"option"}
1492037610640   geckodriver::marionette TRACE   → 62:[0,3,"findElements",{"using":"css selector","value":"option"}]
1492037610652   geckodriver::marionette TRACE   ← [1,3,null,[{"element-6066-11e4-a52e-4f735466cecf":"b98c22f1-84f6-41b8-b0c6-6138e46b798b","ELEMENT":"b98c22f1-84f6-41b8-b0c6-6138e46b798b"},{"element-6066-11e4-a52e-4f735466cecf":"718958da-3b77-4e0d-be02-04d621d26828","ELEMENT":"718958da-3b77-4e0d-be02-04d621d26828"},{"element-6066-11e4-a52e-4f735466cecf":"84cfb36b-1a21-41e1-8266-28a11adc92e3","ELEMENT":"84cfb36b-1a21-41e1-8266-28a11adc92e3"},{"element-6066-11e4-a52e-4f735466cecf":"ba306911-6b11-40c0-8e3d-5e1de0c33b4f","ELEMENT":"ba306911-6b11-40c0-8e3d-5e1de0c33b4f"}]]
1492037610653   webdriver::server       DEBUG   Returning status Ok
1492037610653   webdriver::server       DEBUG   Returning body {"value":[{"element-6066-11e4-a52e-4f735466cecf":"b98c22f1-84f6-41b8-b0c6-6138e46b798b"},{"element-6066-11e4-a52e-4f735466cecf":"718958da-3b77-4e0d-be02-04d621d26828"},{"element-6066-11e4-a52e-4f735466cecf":"84cfb36b-1a21-41e1-8266-28a11adc92e3"},{"element-6066-11e4-a52e-4f735466cecf":"ba306911-6b11-40c0-8e3d-5e1de0c33b4f"}]}
1492037610680   webdriver::server       DEBUG   Got request POST AbsolutePath("/session/878fe0df-2131-43b3-b649-39844d38c895/actions")
1492037610681   webdriver::command      DEBUG   Got request body {"actions":[{"type":"pointer","id":"default mouse","parameters":{"pointerType":"mouse"},"actions":[{"type":"pointerMove","duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"718958da-3b77-4e0d-be02-04d621d26828"},"x":0,"y":0},{"type":"pointerDown","button":0},{"type":"pointerUp","button":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pointerMove","duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"84cfb36b-1a21-41e1-8266-28a11adc92e3"},"x":0,"y":0},{"type":"pointerDown","button":0},{"type":"pointerUp","button":0},{"type":"pointerMove","duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"ba306911-6b11-40c0-8e3d-5e1de0c33b4f"},"x":0,"y":0},{"type":"pointerDown","button":0},{"type":"pointerUp","button":0},{"type":"pause","duration":0}]},{"type":"key","id":"default keyboard","actions":[{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"keyDown","value":""},{"type":"pause","duration":100},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"keyUp","value":""}]}]}
1492037610690   geckodriver::marionette TRACE   → 1244:[0,4,"performActions",{"actions":[{"actions":[{"duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"718958da-3b77-4e0d-be02-04d621d26828"},"type":"pointerMove","x":0,"y":0},{"button":0,"type":"pointerDown"},{"button":0,"type":"pointerUp"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"84cfb36b-1a21-41e1-8266-28a11adc92e3"},"type":"pointerMove","x":0,"y":0},{"button":0,"type":"pointerDown"},{"button":0,"type":"pointerUp"},{"duration":250,"origin":{"element-6066-11e4-a52e-4f735466cecf":"ba306911-6b11-40c0-8e3d-5e1de0c33b4f"},"type":"pointerMove","x":0,"y":0},{"button":0,"type":"pointerDown"},{"button":0,"type":"pointerUp"},{"duration":0,"type":"pause"}],"id":"default mouse","parameters":{"pointerType":"mouse"},"type":"pointer"},{"actions":[{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"type":"keyDown","value":""},{"duration":100,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"type":"keyUp","value":""}],"id":"default keyboard","type":"key"}]}]
1492037611825   geckodriver::marionette TRACE   ← [1,4,null,{}]
1492037611856   webdriver::server       DEBUG   Returning status Ok
1492037611857   webdriver::server       DEBUG   Returning body {"value": {}}
@mjzffr mjzffr self-assigned this Apr 18, 2017
@andreastt
Copy link
Contributor

I guess this could be because the shift modifier isn’t properly set on the DOM event we generate. That only the last <option> gets clicked could mean it clicks through all of them, but without the shift modifier.

@mjzffr
Copy link
Contributor

mjzffr commented May 24, 2017

I'll work on this in https://bugzilla.mozilla.org/show_bug.cgi?id=1367430

@mjzffr
Copy link
Contributor

mjzffr commented May 24, 2017

(Likely the issue is in Marionette's event.js)

@mjzffr
Copy link
Contributor

mjzffr commented Jun 8, 2017

https://bugzilla.mozilla.org/show_bug.cgi?id=1367430 has landed in mozilla-central

@mjzffr mjzffr closed this as completed Jun 8, 2017
@lock
Copy link

lock bot commented Aug 17, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants