问题
May i assume that for every web page the WebElement.getText()
function does return utf8 Strings, or can it have other encodings?
If there could be other encodings, how can i identify it and convert it to utf8?
回答1:
I don't know no one good way(maybe if you like reflection, you can hack and rewrite) to do getText() return needed encoding. But in this Selenium web driver and multillanguage I wrote some way to encode String.
回答2:
I don't think so. According to the API, getText()
returns a String
. You will have to find the encoding of that from the page headers.
来源:https://stackoverflow.com/questions/18353988/webelement-gettext-function-and-utf8