gpt4 book ai didi

python - 错误 : type object 'Keys' has no attribute 'chord'

转载 作者:太空狗 更新时间:2023-10-29 23:58:17 26 4
gpt4 key购买 nike

我在执行 selenium 代码时遇到以下错误。

代码:

driver.find_element_by_id(PlaylistManagerLocators.Folder_Name).send_keys(Keys.chord(Keys.CONTROL, "a"), "Auto_Folder5763")

错误:

AttributeError: type object 'Keys' has no attribute 'chord'

我已经导入了所有需要的文件。

from selenium.webdriver.common.keys import Keys
from selenium.webdriver import ActionChains


driver.find_element_by_id(PlaylistManagerLocators.Folder_Name).send_keys(Keys.chord(Keys.CONTROL, "a"), "Auto_Folder5763")

最佳答案

selenium.webdriver.common.keys.Keys 中没有作为和弦 的函数(检查文档)。您可以简单地将其拆分为 2 个语句。

driver.find_element_by_id(id).send_keys(Keys.CONTROL + "a")
driver.find_element_by_id(id).send_keys("Auto_Folder5763")

或者如果你想同时按下这些键,那么你可以尝试使用 selenium.webdriver.common.action_chains.ActionChains .

关于python - 错误 : type object 'Keys' has no attribute 'chord' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33915900/

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