【问题标题】:Assert for special characters in python Appium在 python Appium 中断言特殊字符
【发布时间】:2016-05-29 11:10:00
【问题描述】:

如何使用 Appium 在 python 中声明特殊字符。我尝试更改文本编码,但没有帮助,默认情况下我使用的是 UTF-8 文本编码 (Eclipse)

我想断言下面提到的文字:

文字:Köp avslutat

我的文本 xpath 是:

Xpath: //UIAApplication[1]/UIAWindow[4]/UIAStaticText[1]

我的代码在这里:

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")

【问题讨论】:

  • 您在这里遇到的错误是什么?

标签: python ios selenium appium


【解决方案1】:

我想通了,有Unicode字符编码和Python使用不同的编码

www.fileformat.info/info/unicode/char/0308/index.htm

它适用于:u*ko\u0308p avslutat"

【讨论】:

    猜你喜欢
    • 2017-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    相关资源
    最近更新 更多