-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[🐛 Bug]: IWebDriver.Manage().Network.StartMonitoring() causes file uploads to fail #14903
Comments
@MJB222398, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Hi @MJB222398 , I remember you were involved in internal logs (if my memory doesn't lye me): https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/ - can you please provide? |
@nvborisenko apologies I can provide yes in a couple of hours. From the driver logs or the selenium container logs? However it should be straightforward for you to replicate. But yes that was me I think |
I have executed your code, what is expected behavior? It was success on my side. |
So if you use large file size (100mb say) and use the code given the upload should fail. If you comment out the network monitoring line then it should do the upload successfully |
I tried to |
That is very strange. If I run this: IWebDriver driver = null;
try
{
driver = new ChromeDriver();
driver.Manage().Network.StartMonitoring().GetAwaiter().GetResult();
driver.Navigate().GoToUrl("https://tus.io/demo");
Thread.Sleep(1000);
driver.FindElement(By.Id("P0-0")).SendKeys("C:\\Users\\xxxxx\\Downloads\\goldfinch4_Trim.mp4");
Thread.Sleep(22000);
}
finally
{
driver?.Quit();
} Then 100% of the time it will fail to do the upload. The screen will be stuck like this: If instead I run this: IWebDriver driver = null;
try
{
driver = new ChromeDriver();
//driver.Manage().Network.StartMonitoring().GetAwaiter().GetResult();
driver.Navigate().GoToUrl("https://tus.io/demo");
Thread.Sleep(1000);
driver.FindElement(By.Id("P0-0")).SendKeys("C:\\Users\\xxxxx\\Downloads\\goldfinch4_Trim.mp4");
Thread.Sleep(22000);
}
finally
{
driver?.Quit();
} Then 100% of the time the upload succeeds: I have tried this many times on 2 machines on 2 different networks and the results are always as above. |
@nvborisenko Trace level driver logs uploaded to https://www.filemail.com/d/xbkqrdjzsxgdvms |
Got it, reproduced locally. It doesn't depend on file size. I used 300KB file and it failed. Silently... The last remote message was CDP |
Ok nice, glad I'm not crazy haha. So what can be done about it? You want to add some defensive code in the event handling/deserialisation? |
I caught it:
(modified |
The issue is not reproducible in Selenium v4.23 where |
The remote version is still the same, it is chrome 131. So it is really related to deserialization. I blame |
Ah yes been bitten by that migration myself. Had to write a lot of unit tests using Verify to check that the serialisation did not change. But it is hard to cover everything. |
@MJB222398 please share your experience, it would be helpful. When I see string representation of json in VS Code, it cannot be formatted properly. |
Didn't help, it works with textual files, but not with binary files. BUT What options I see:
|
That migration was quite a few years ago now I'm afraid , all I remember is the importance and usefulness of the unit tests rather than what the differences actually were and how to resolve them. Seems odd that postData is deprecated while postDataEntries is still labeled as 'Experimental'. |
What happened?
I have a project that uploads files into the web app under test on the Chrome browser. With Selenium 4.23 this was working flawlessly. I tried to update to Selenium 4.27 and with no changes other than this NuGet package version this stopped working.
The implementation of the web app under test is such that when files are uploaded this is done in 4MB chunks. If the file size is less than 4MB then the upload still works as it used to with 4.23. However if the size is greater than 4MB such that it is chunked then the upload will not work anymore.
Narrowing it down I eventually find that it is a call to IWebDriver.Manage().Network.StartMonitoring() that appears to be the cause. If I remove this line it works fine, with it it will not do the upload.
How can we reproduce the issue?
Here is a simple example to see the issue. Note that this is not the site I was testing, I cannot give you access to that, but this one appears to show the issue too. Note here I don't know the chunking size for this site but I was observing failure using a file that was 80MB and seeing success with a file that was 1KB.
Relevant log output
Trace level driver logs are 200MB so cannot upload or paste in here. Please download from: https://www.filemail.com/d/xbkqrdjzsxgdvms
Operating System
Windows 10
Selenium version
4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome 131.0.6778.140
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 131.0.6778.140
Are you using Selenium Grid?
I was but seems not necessary to reproduce the issue
The text was updated successfully, but these errors were encountered: