[英]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.有没有什么通用的方法可以访问节点系统等的系统文件?
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.