Python/Selenium没有向输入字段发送波浪号(〜) [英] Python/ Selenium is not sending tilde character (~) to the input field
问题描述
我正在尝试使用Python/Selenium/Webdriver自动填充Chrome网页中的输入字段.但是,我无法使用"send_keys"填写代字号.
I'm trying to use Python/ Selenium/ Webdriver to automatically fill an input field in my Chrome webpage. However, I am not able to use "send_keys" to fill out the tilde character.
这是我到目前为止尝试过的:
Here is what I've tried so far:
import os
import sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
browser = webdriver.Chrome(executable_path=r"chromedriver.exe")
browser.get("https://mywebpageaddress")
browser.find_element_by_id("username").send_keys('charles~18')
但是该字段中没有出现〜"波浪号.
But the "~" tilde is not appearing on the field.
将其填充为"charles18",而不是"charles〜18"
It is filled just as "charles18" instead of "charles~18"
有帮助吗?谢谢!
推荐答案
根据文档,您可以调用多次 send_keys 方法.
As per documentation you can call multiple time send_keys method.
尝试一下. 1.用〜分割网址 2.将每个碎片一一发送. 3.仅用于〜只需发送其unicode'\ ue07E'
Try this. 1. split url by ~ 2. send every fragmentation one by one. 3. only for ~ just send its unicode '\ue07E'
但是,这没有在任何地方指定.但是7E是〜的unicode 硒的特殊键映射是此处.希望对您有所帮助.
However this is not specify anywhere. but 7E is unicode for ~ special key mapping for selenium is here. Hope this help.
硒键的Java文档位于此处
Java doc for selenium key is here
这篇关于Python/Selenium没有向输入字段发送波浪号(〜)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!