selenium 右键另存为操作


from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Firefox()
browser.get('https://www.baidu.com')
btn = browser.find_element_by_id('lg').find_element_by_tag_name('img')
ActionChains(browser).context_click(btn).send_keys('V').perform()

通过ActionChains类先使用context_click()点击元素,在发送V键,即另存为,最后perform

在火狐浏览器可用


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM