mirror of
https://github.com/servo/servo.git
synced 2025-08-26 23:58:20 +01:00
script(webdriver): Element send keys append to the end of filelist
if Multiple (#38407)
Step 8.6 of [Element Send Keys](https://w3c.github.io/webdriver/#dfn-element-send-keys) remote end's implementation. > 6. Complete implementation specific steps equivalent to setting the [selected files](https://w3c.github.io/webdriver/#dfn-selected-files) on the [input](https://w3c.github.io/webdriver/#dfn-input) element. **If multiple is true files are be appended to element's [selected files](https://w3c.github.io/webdriver/#dfn-selected-files).** Testing: `webdriver/tests/classic/element_send_keys/file_upload.py` Fixes: https://github.com/servo/servo/issues/38190 --------- Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com> Co-authored-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
011b314478
commit
a75f3fd09b
2 changed files with 16 additions and 6 deletions
|
@ -31,6 +31,7 @@ use net_traits::filemanager_thread::{FileManagerResult, FileManagerThreadMsg};
|
||||||
use net_traits::{CoreResourceMsg, IpcSend};
|
use net_traits::{CoreResourceMsg, IpcSend};
|
||||||
use script_bindings::codegen::GenericBindings::CharacterDataBinding::CharacterDataMethods;
|
use script_bindings::codegen::GenericBindings::CharacterDataBinding::CharacterDataMethods;
|
||||||
use script_bindings::codegen::GenericBindings::DocumentBinding::DocumentMethods;
|
use script_bindings::codegen::GenericBindings::DocumentBinding::DocumentMethods;
|
||||||
|
use servo_config::pref;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use style::selector_parser::PseudoElement;
|
use style::selector_parser::PseudoElement;
|
||||||
use style::str::{split_commas, str_join};
|
use style::str::{split_commas, str_join};
|
||||||
|
@ -2293,6 +2294,21 @@ impl HTMLInputElement {
|
||||||
let target = self.upcast::<EventTarget>();
|
let target = self.upcast::<EventTarget>();
|
||||||
|
|
||||||
if self.Multiple() {
|
if self.Multiple() {
|
||||||
|
// When using WebDriver command element send keys,
|
||||||
|
// we are expected to append the files to the existing filelist.
|
||||||
|
if pref!(dom_testing_html_input_element_select_files_enabled) {
|
||||||
|
let filelist = self.filelist.get();
|
||||||
|
if let Some(filelist) = filelist {
|
||||||
|
for i in 0..filelist.Length() {
|
||||||
|
files.push(
|
||||||
|
filelist
|
||||||
|
.Item(i)
|
||||||
|
.expect("We should have iterate within filelist length"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let opt_test_paths = opt_test_paths.map(|paths| {
|
let opt_test_paths = opt_test_paths.map(|paths| {
|
||||||
paths
|
paths
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
[file_upload.py]
|
[file_upload.py]
|
||||||
[test_multiple_files_send_twice]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_single_file_appends_with_multiple_attribute]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_strict_hidden]
|
[test_strict_hidden]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue