[英]Selenium send text in file with unicode emoji
i need to send selenium unicode it sends everything in the file in the text box.我需要发送 selenium unicode 它发送文本框中文件中的所有内容。 it must send the emoji too and not just the text
它也必须发送表情符号,而不仅仅是文本
file.txt文件.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}
'''
)
let's say you've a string like this :假设你有一个这样的字符串:
str_ = "this is a line \uD83D\uDD25"
and you wanna parse that into send_keys()
method, you can do it this way :-你
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.