简体   繁体   English

如何验证从 selenium 节点系统上运行的 chrome 浏览器下载的文件

[英]how can I verify a file downloaded from chrome browser running on selenium node system

Want to verify that the file is getting downloaded in actual or not not just success message pop-up validation想要验证文件是否正在实际下载,而不仅仅是成功消息弹出验证

I considered using file.exist() in my code but that checks locally wher my code is being executed.我考虑过在我的代码中使用file.exist()但它会在本地检查我的代码是否正在执行。 Also I considered opening default Download location in browser and get page source and do check contains but with that aproach I stuck with getting the node system's username (without it i can define the exact path to open in browser eg C://Users/<username>/Downloads . Also tried opening chrome://downloads in browser but downloading source from there doesn't contain file name:(我还考虑在浏览器中打开默认下载位置并获取页面源并检查包含但使用这种方法我坚持获取节点系统的用户名(没有它我可以定义在浏览器中打开的确切路径例如C://Users/<username>/Downloads 。还尝试在浏览器中打开chrome://downloads但从那里下载源不包含文件名:(

is there any in general way to access system files of node system etc.有没有什么通用的方法可以访问节点系统等的系统文件?

  1. Before and after download check file's modified date下载前后检查文件的修改日期
  2. Another way is to check the file path where the file is getting downloaded.另一种方法是检查下载文件的文件路径。

You can use the os module in Node.js to get the current user's home directory after that append the path to the download location您可以使用 Node.js 中的 os 模块获取当前用户的主目录 append 下载位置的路径
(eg "Downloads" on Windows and Mac, "~/Downloads" on Linux). (例如,Windows 和 Mac 上的“下载”,Linux 上的“~/下载”)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用Selenium在浏览器堆栈中验证下载的文件吗 - Can i verify downloaded file in browser stack using selenium 是否可以使用 selenium 从 Chrome 浏览器读取下载的文件 - is it possible to read the downloaded file from chrome browser using selenium 如何验证文件已在android中完全下载? - How can I verify that a file was completely downloaded in android? 如何使用 Selenium RemoteWebDriver 删除下载的文件? - How can I delete a downloaded file using Selenium RemoteWebDriver? 如何使用chrome浏览器更改下载文件的默认目录 - how to change the default directory for the downloaded file using chrome browser 在使用 Selenium Grid 时,我们如何从 Hub 机器访问 Node 机器中下载的文件? - While using Selenium Grid, How do we access downloaded file in Node machine from Hub machine? 如何防止控制器方法在Chrome浏览器的Spring Boot中运行两次? - How can I prevent controller methods from running twice in spring boot in chrome browser? 如何验证特定文本下的文本 <DIV> 使用Selenium WebDriver(java)和Chrome浏览器标记? - How can I verify presence of text under a specific <DIV> tag using Selenium WebDriver (java) and Chrome? 如何在运行 Selenium 脚本时禁用 Chrome 浏览器中的身份验证弹出窗口 - How to disable the authentication popup in chrome browser while running Selenium Script 如何验证文件已下载 - How to verify that a file has been downloaded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM