Reputation: 29
How to assert special characters in python using Appium. I have tried to change the text encoding but it does not help, by default i am using UTF-8 text encoding (Eclipse)
I would like to assert the below mentioned text:
Text: Köp avslutat
My xpath for the text is:
Xpath: //UIAApplication[1]/UIAWindow[4]/UIAStaticText[1]
My code is here:
try:
assert_var = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[4]/UIAStaticText[1]")
return assert_var.text == "Köp avslutat"
WebdriverWait(self.driver, 10).until(EC.presence_of_element_located(xpath of element))
except:
raise NoSuchElementException("Unable to locate assert text")
Upvotes: 1
Views: 843
Reputation: 29
I have figured it out, there are Unicode character Encoding and Python uses different encoding
www.fileformat.info/info/unicode/char/0308/index.htm
and it worked with: u*ko\u0308p avslutat"
Upvotes: 1