Problem when trying to upload a zip file with Selenium C# using remote webdriver. File not found

0

To deal with our automation testing execution, we are using the solution Moon from Aerokube. We have a Kubernetes cluster and execute our automated tests on Kubernetes pods. When we trigger a specific scenario from Azure DevOps on Moon, we face a problem when we want to upload a zip file via our website under test. It works fine when we try to upload any other type of files (pdf, ...). It works fine when we are uploading a zip file but only when we trigger our scenario locally.

The code we use is:

    if (driver is IAllowsFileDetection allowsDetection)
    {
        allowsDetection.FileDetector = new LocalFileDetector();
    }
    uploadBtn.SendKeys(TestDataPath + "\\" + ConfigManager.GetTestData("HTMLZip", "UploadFiles_Videos") + ".zip");
    
    //uploadBtn is the element for the upload button where the file is uploading

The stack trace we get is the following:

**OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  **Message=invalid argument: File not found : <html>
  (Session info: chrome=89.0.4389.72)**
  Source=WebDriver**

StackTrace:
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary 2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
   at Journal.Base.SourceCode.ProductionForumModule.ProductionForum.UploadsInProduction(String contentType, String fileType, String ArticleName) in E:\Sudheesh.m\NewRepo\Journal.Base\SourceCode\ProductionForum\ProductionForum.cs:line 1930
   at ProductionForumModule.SmokeSuite.ProductionForumTest.UploadHtmlZipAndXmlZip() in E:\Sudheesh.m\NewRepo\ProductionForum\ProductionForumTest.cs:line 2770

So we get File not found on this line of code uploadBtn.SendKeys(TestDataPath + "\" + ConfigManager.GetTestData("HTMLZip", "UploadFiles_Videos") + ".zip"); We checked the absolute path and it is the right one. Plus like i said it works fine with other type of files. We can upload the same zip file stored in the same location only if we trigger the scope locally (not on Moon).

Any idea why and how to fix it?

FYI, we are using NUnit framework.

Thank you very much for your help. Kind regards, Benoit.

c#
selenium
kubernetes
zipfile
remotewebdriver
asked on Stack Overflow Mar 17, 2021 by Benoit

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0