我正在创建一个从 Excel 工作表获取 URL 的应用程序,但它在 URL 中有波浪号('~')。当我使用 selenium 将其复制到输入字段时,该字符不会自行复制。
我遇到了 this去年的帖子,但没有人能解决这个问题。所以希望有人会知道答案:)
提前致谢!
#Fill in Discription
driver.find_element_by_xpath('//[@id="description"]').send_keys(Description)
最佳答案
这是我们的 friend @Mithun Mandal 在另一篇文章中所说的内容的表示(它在 C# 中,考虑到它是 selenium,转换为 python 应该不难)。
string url = "www.test~dummy.com";
foreach (string x in url.Split('~'))
{
element.SendKeys(x);
element.SendKeys("\u223C");
}
element.SendKeys(Keys.Backspace); //this is used to erase the wrong tilde typed at the end of the URL
曾在这里工作。
关于python - Selenium 未向输入字段发送波浪字符 (~),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55816078/