gpt4 book ai didi

python - WinAppDriver 和 Appium - send.keys() 发送 '#' 代替 ''\'

转载 作者:太空宇宙 更新时间:2023-11-04 04:31:43 27 4
gpt4 key购买 nike

我在使用 WinAppDriver 和 Appium 发送反斜杠字符时遇到问题。当我使用 send.keys 发送反斜杠字符时,会在其位置发送一个“#”字符。我尝试过多种方式(如下所示)。

Appium v​​ 0.28

WinnAppDriver v 1.1.1809.18001

from appium import webdriver

desired_caps = {'app': 'Root', 'autoLaunch': 'false'}
driver = webdriver.Remote(command_executor='http://127.0.0.1:4723',
desired_capabilities=desired_caps)
w1 = driver.find_element_by_name('Untitled - Notepad')
for elem in w1.find_elements_by_name('Text Editor'):
elem.send_keys(chr(92))
elem.send_keys('\\')
elem.send_keys(r'C:\test')

最佳答案

目前这是一个错误。 (阅读更多相关信息 here 例如。)

如果您不使用美式键盘布局,则不能将 \ 作为字符串发送。对于肮脏的解决方法,您可以通过按下 ALT,然后按数字 9 和 2,然后释放 ALT,通过其 ASCII 代码键入字符,如所述 here :

Keys.Alt + Keys.NumberPad9 + Keys.NumberPad2 + Keys.Alt

关于python - WinAppDriver 和 Appium - send.keys() 发送 '#' 代替 ''\',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52533272/

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