它按下回车,但它不执行 Ctrl + Z 所以我怎么能这样程序首先按下 ENTER 而不是 Cltr + Z
afile = open("test.txt", "r")
for line in afile:
pieces = line.split("\n")
test = pieces[0]
donotuse = pieces[1]
actions = ActionChains(driver)
actions.send_keys(test)
actions.perform()
actions = ActionChains(driver)
actions.send_keys(Keys.ENTER)
actions.perform()
actions = ActionChains(driver)
actions.key_down(Keys.CONTROL).send_keys('Z').key_up(Keys.CONTROL).perform()
您的问题不在于使用Ctrl+Z
inSelenium
而不是缺少正确的actions.key_down(Keys.CONTROL).send_keys('Z').key_up(Keys.CONTROL).perform()
代码行缩进,这使该行脱离了对象未初始化的for
循环actions
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句