You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drivers should throw "invalid argument" error on an attempt to click file input #4843
Selenium leaves control after clicking to file explorer Browse button in MS Edge. This works fine in Chrome and Firefox but absolutely blocking to run next step in the code. I tried code via all possible ways and below code works to click to Browse button but after this step selenium leaves control because file explorer window opens. Is this Selenium or MS Edge driver issue?
Environment:
Selenium version - Latest 3.6.0
Browser - MS Edge
MS Edge Driver - Latest Release 15063
Application type - Ajax web
Steps:
1. Open ajax web application through MS Edge (works)
2. Click to browse button through web driver core or java script method (works)
3. Selenium gone, leaves control till we close file explorer button (doesn't work) - this works fine in GC and FF. 4 (Blocked). Send key to type file name or implement AutoIt script (works) 5 (Blocked). Click to open button via AutoIt script (works) 6 (Blocked). File attached fine (works)
Working code:
driver.findElement(By.id("browseID")).click();
And
WebElement we = null;
((JavascriptExecutor)ClientSessionFactory.session().webDriver()).executeScript("document.getElementsByName('browseName')[0].click()", we);
This is actually blocking attachment functionality and it would be great if selenium will fix this. So far i just see Autoit is the solution as a 3rd party software but it is very tedious to add separate scripts for every browse buttons in the application, any code by selenium blocks due to OS dialog appearance. Anyone faced this issue?
Sorry but its not good to close the major issue like this where execution gets blocked. There must be some issue from Selenium or MS Edge driver side which needs to be put on attention to them.
It's not an issue, but intended behavior. To enter a value to a file input one have to sendKeys to it. Click to a file input raises a native file selection dialogue that can't be handled by selenium.
You're right, I was too hasty closing the issue. But I have to reframe it.
In original Selenium API it was implicitly prohibited to click file input fields, behavior was undefined, and drivers could autoclose file selectoin dialogue, or block on it, any behavior was "allowed".
But W3C WebDriver standard is mode definitive, it says "If the element is an input element in the file upload state return error with error code invalid argument." [1]
None of the drivers implemens this requirement yet. So I'll reopen this issue on legacy Firefox driver and IE driver developed by Selenium team. And I'll raise new issues on other drivers in the corresponding trackers.
changed the title [-]Selenium leaves control after clicking to file explorer Browse button in MS Edge[/-][+]Drivers should throw "invalid argument" error on an attempt to click file input[/+]on Oct 11, 2017
I tried passing in the send keys and still it leaves the browser open. I can use autoit for the file upload control but it is getting timed out, since it is not leaving the control on sendkeys.
Activity
barancev commentedon Oct 10, 2017
Don't click file inputs, just sendKeys to them.
jiteshsojitra commentedon Oct 10, 2017
Sorry but its not good to close the major issue like this where execution gets blocked. There must be some issue from Selenium or MS Edge driver side which needs to be put on attention to them.
barancev commentedon Oct 10, 2017
It's not an issue, but intended behavior. To enter a value to a file input one have to sendKeys to it. Click to a file input raises a native file selection dialogue that can't be handled by selenium.
jiteshsojitra commentedon Oct 10, 2017
This is working fine in Chrome and Firefox so i'm pretty sure this is an issue with MS Edge. Please re-read the issue.
barancev commentedon Oct 11, 2017
You're right, I was too hasty closing the issue. But I have to reframe it.
In original Selenium API it was implicitly prohibited to click file input fields, behavior was undefined, and drivers could autoclose file selectoin dialogue, or block on it, any behavior was "allowed".
But W3C WebDriver standard is mode definitive, it says "If the element is an input element in the file upload state return error with error code invalid argument." [1]
None of the drivers implemens this requirement yet. So I'll reopen this issue on legacy Firefox driver and IE driver developed by Selenium team. And I'll raise new issues on other drivers in the corresponding trackers.
[1] https://w3c.github.io/webdriver/webdriver-spec.html#element-click
[-]Selenium leaves control after clicking to file explorer Browse button in MS Edge[/-][+]Drivers should throw "invalid argument" error on an attempt to click file input[/+]barancev commentedon Oct 11, 2017
Test for this feature: d48e75b
Legacy Firefox driver: 0e680bc
barancev commentedon Oct 12, 2017
Issue on chromedriver: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2073
Issue on geckodriver: mozilla/geckodriver#1011
KS261187 commentedon Dec 22, 2017
I tried passing in the send keys and still it leaves the browser open. I can use autoit for the file upload control but it is getting timed out, since it is not leaving the control on sendkeys.
ChintanShahX commentedon Jul 5, 2018
Any update on this issue? or any workaround that can be used for Edge browser
barancev commentedon Jan 26, 2021
According to the current test status it's fixed in both Firefox and Chrome drivers.