问题描述
为了处理我们的自动化测试执行,我们使用了 Aerokube 的解决方案 Moon。我们有一个 Kubernetes 集群并在 Kubernetes pod 上执行我们的自动化测试。 当我们从 Moon 上的 Azure DevOps 触发特定场景时,当我们想要通过我们的测试网站上传 zip 文件时,我们会遇到问题。 当我们尝试上传任何其他类型的文件(pdf,...)时,它工作正常。 当我们上传 zip 文件时它工作正常,但仅当我们在本地触发我们的场景时。
我们使用的代码是:
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
我们得到的堆栈跟踪如下:
**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
所以我们在这行代码中得到 File not found uploadBtn.SendKeys(TestDataPath + "\" + ConfigManager.GetTestData("HTMLZip","UploadFiles_Videos") + ".zip "); 我们检查了绝对路径,它是正确的。另外就像我说的它适用于其他类型的文件。仅当我们在本地(而不是在月球上)触发范围时,我们才能上传存储在同一位置的相同 zip 文件。
知道为什么以及如何修复它吗?
仅供参考,我们使用的是 NUnit 框架。
非常感谢您的帮助。 亲切的问候, 伯努瓦。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)