您可以在硒中使用send_keys一次上传两个文件吗?

发布于 2025-01-27 02:55:02 字数 415 浏览 2 评论 0原文

我正在尝试将两个文件上传到网页上的元素中 - 但是,成功上传一个文件并尝试上传另一个文件后,我会收到以下错误:

发生了例外:StaleelementReferenceException 消息:陈旧元素参考:元素未连接到页面文档

因此,我想知道是否有一种可以同时上传两个文件的方法。尽管这无效,但它会奏效:

uploadFiles.send_keys("C:\\Users\\jack_l\\Desktop\\IMAGES\\"+str(image) and "C:\\Users\\jack_l\\Documents\\Image-Line\\FL Studio\\Projects\\finished\\UPLOAD\\"+str(file))

任何帮助将不胜感激。

I'm trying to upload two files into an element on a webpage – however, after successfully uploading one and trying to upload the other, I get the following error:

Exception has occurred: StaleElementReferenceException
Message: stale element reference: element is not attached to the page document

So, I was wondering if there was a way to upload two files at the EXACT same time. Although this doesn't work, it would work something like:

uploadFiles.send_keys("C:\\Users\\jack_l\\Desktop\\IMAGES\\"+str(image) and "C:\\Users\\jack_l\\Documents\\Image-Line\\FL Studio\\Projects\\finished\\UPLOAD\\"+str(file))

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

琉璃繁缕 2025-02-03 02:55:02
"C:\\Users\\jack_l\\Desktop\\IMAGES\\"+str(image)+ "\n C:\\Users\\jack_l\\Documents\\Image-Line\\FL Studio\\Projects\\finished\\UPLOAD\\"+str(file)

应该将两个文件发送到输入标签。

\ n将每个文件路径分开。

"C:\\Users\\jack_l\\Desktop\\IMAGES\\"+str(image)+ "\n C:\\Users\\jack_l\\Documents\\Image-Line\\FL Studio\\Projects\\finished\\UPLOAD\\"+str(file)

Should send two files to an input tag.

\n seperates each file path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文