简体   繁体   中英

Robot Framework: Unable to run the Robot test case with variables that has unicode in the file

When I try to run the following script I get the error:

UnicodeDecodeError: 'utf8' codec can't decode byte 0xa5 in position 63: invalid start byte

Note- I have to use the same variable , so alternative locators But if remove the yen symbol it works fine-` how to fix it

***Settings***
Library    Selenium2Library

*** Variables ***
${DC_CURRENCY_SELECTOR_VERIFY}   xpath=//label[contains(text(),' ¥ 10')] 


***Test Cases***
Test browser
    open browser    http://google.com    chrome

You can use the string keywords provided by Robot framework in order to encode your variable. I believe something like this will work:

${DC_CURRENCY_SELECTOR_VERIFY} =    Encode String To Bytes    ${DC_CURRENCY_SELECTOR_VERIFY}   ASCII    errors=ignore

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