gpt4 book ai didi

python - 发送 Ctrl+f python selenium chrome

转载 作者:太空宇宙 更新时间:2023-11-03 15:16:02 38 4
gpt4 key购买 nike

我可以使用一些键,例如 Tab

browser.find_element_by_tag_name('body').send_keys(Keys.TAB)

但不是 Ctrl+fCtrl+p

browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL +'f')

我还尝试使用 xpath find_element_by_xpath & send_keys(Keys.CONTROL,'f') 但仍然无法正常工作

最佳答案

您应该尝试在 selenium webdriver 中使用 action_chains

from selenium.webdriver.common.action_chains import ActionChains
#
# Your code
#
browser.find_element_by_tag_name('body')
ActionChains(browser).send_keys(Keys.CONTROL, "f").perform()

关于python - 发送 Ctrl+f python selenium chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43884979/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com