[英]Selenium send text in file with unicode emoji
我需要發送 selenium unicode 它發送文本框中文件中的所有內容。 它也必須發送表情符號,而不僅僅是文本
文件.txt
this is a line \uD83D\uDD25
with open('file.txt') as f:
lines = f.readlines()
test = driver.find_element_by_xpath("//input[@title='Search']")
test.send_keys(u'''
{lines}
'''
)
假設你有一個這樣的字符串:
str_ = "this is a line \uD83D\uDD25"
你send_keys()
它解析成send_keys()
方法,你可以這樣做:-
test = driver.find_element_by_xpath("//input[@title='Search']")
test.send_keys({str_})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.