Chrome网络驱动器发送密钥不会发送'3' [英] Chrome webdriver send keys does not send '3'
问题描述
出于某种原因,我无法在页面的输入元素中写入字符'3'。
此代码:
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编辑:
login.send_keys(3)
login.send_keys(\ 3)
也不行。
login.send_keys(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@ #$%^& *())
- 只有3字符串...
有效的是
pre $ login.send_keys( Keys.NUMPAD3)
作为Andersson下面的建议,但这不是一个解决方案。
我在谷歌搜索框中试过了,而且我经历了同样的行为。
更新至最新 chrome驱动程式已解决此问题。
For some reason, I am unable to write character '3' into the input element on the page.
This code:
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")
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
EDIT:
login.send_keys("3")
login.send_keys("\3")
don't work either.
login.send_keys("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()")
- only the "3" was missing in the string...
what worked was
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.
Updating to latest chrome driver resolved this issue.
这篇关于Chrome网络驱动器发送密钥不会发送'3'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!