Chrome 网络驱动程序发送密钥不发送“3"

2022-01-16 00:00:00 python selenium webdriver google-chrome

问题描述

由于某种原因,我无法将字符3"写入页面上的输入元素.

For some reason, I am unable to write character '3' into the input element on the page.

这段代码:

    chrome_options = Options()
    chrome_options.add_argument('--dns-prefetch-disable')
    chrome_options.add_argument('--no-proxy-server')
    chromeDriverPath = self.getChromeDriverPath()
    os.environ["webdriver.chrome.driver"] = chromeDriverPath
    self.driver = webdriver.Chrome(chromeDriverPath, chrome_options=chrome_options)

    self.driver.get(self.loginUrl)
    login = self.driver.find_element_by_id('login_credit')
    login.send_keys("12345")

导致登录输入中写入1245"...有人可以帮忙吗?我用的是python 2.7,最新的chrome和最新的chromedriver

results in "1245" being written in the login input... Can someone help please? I use python 2.7, the latest chrome and the latest chromedriver

login.send_keys("3")

login.send_keys("3")

也不行.

login.send_keys("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()")

- 字符串中仅缺少3"...

- only the "3" was missing in the string...

有效的是

login.send_keys(Keys.NUMPAD3)

正如安德森在下面建议的那样,但这不是解决方案.

as Andersson suggested below, but this is not a solution.

我在谷歌搜索框中尝试过,我遇到了同样的行为.

I tried it in the google search box and I experienced the same behaviour.


解决方案

更新到最新版本 chrome 驱动程序 解决了这个问题.

Updating to latest chrome driver resolved this issue.

相关文章