Tôi đang sử dụng xpath trong Selenium RC thông qua api Python.Làm thế nào để sử dụng unicode bên trong một chuỗi xpath? (UnicodeEncodeError)
tôi cần phải bấm vào một yếu tố người là văn bản được "Gửi»"
Đây là lỗi mà tôi nhận được:
In [18]: sel.click(u"xpath=//a[text()='Submit \xbb')]")
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
/Users/me/<ipython console> in <module>()
/Users/me/selenium.py in click(self, locator)
282 'locator' is an element locator
283 """
--> 284 self.do_command("click", [locator,])
285
286
/Users/me/selenium.py in do_command(self, verb, args)
201 body = u'cmd=' + urllib.quote_plus(unicode(verb).encode('utf-8'))
202 for i in range(len(args)):
--> 203 body += '&' + unicode(i+1) + '=' + urllib.quote_plus(unicode(args[i]).encode('utf-8'))
204 if (None != self.sessionId):
205 body += "&sessionId=" + unicode(self.sessionId)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 28: ordinal not in range(128)
tôi đã cố gắng nói thêm rằng - nó vẫn ném một UnicodeDecodeError. Bất kỳ ý tưởng nào khác? –