简体   繁体   中英

Selenium send text in file with unicode emoji

i need to send selenium unicode it sends everything in the file in the text box. it must send the emoji too and not just the text

file.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 :-

test = driver.find_element_by_xpath("//input[@title='Search']")
test.send_keys({str_})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM