硒可以在python中查找iD的位置下载链接元素
我正在尝试使Selenium自动上传和下载文件从 https:/https:/8mb.video/ 我可以上传该文件很好,但是在网站上处理后,硒无法找到下载链接的元素,即使给定的ID匹配HTML中的ID。这是我的代码:
driver = webdriver.Edge()
driver.get('https://8mb.video/')
driver.maximize_window()
driver.get("https://8mb.video/")
s = driver.find_element(By.XPATH, "//input[@type='file']")
s.send_keys("C:\\Users\\ijwto\\Desktop\\VUT\\bladee.mp4")
s = driver.find_element(By.ID, "rockandroll")
s.click()
try:
element = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "dllink"))
)
finally:
print("nope")
我还尝试使用不起作用的element_to_be_clickable,并在HTML中检查了iFrame,但找不到任何东西。
任何帮助将不胜感激。
I'm trying to get Selenium to automate uploading and downloading files from https://8mb.video/ I can upload the file just fine, but after it processes on the site Selenium can't locate the element for the download link even though the ID given matches the ID in the html. Here's my code:
driver = webdriver.Edge()
driver.get('https://8mb.video/')
driver.maximize_window()
driver.get("https://8mb.video/")
s = driver.find_element(By.XPATH, "//input[@type='file']")
s.send_keys("C:\\Users\\ijwto\\Desktop\\VUT\\bladee.mp4")
s = driver.find_element(By.ID, "rockandroll")
s.click()
try:
element = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "dllink"))
)
finally:
print("nope")
I've also tried using element_to_be_clickable which didn't work, and checked for iframes in the HTML and didn't find any.
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了下载文件需要
在
在try Block中的element
上单击,如果在最后块中打印
nope
的意图是指示如果找不到元素,则可以在下添加
而不是最后
注意: - WebDriverWait的等待时间可能会增加,以防您试图上传的视频很大,网站需要更多时间来处理它
的解决方案
In order to download the file need to
click
on theelement
in the try blockAlso if the intention of printing
Nope
in the finally block is to indicate if the element was not found then it can be added underexcept
instead offinally
Note:- The wait time for WebDriverWait may increase in case the video you are trying to upload is large and the site requires more time to process it
Your solution would like