Different charsets of strings returned by getText() for FirefoxDriver and RemoteWebDriver

881 views
Skip to first unread message

Tyoma

unread,
Dec 28, 2009, 9:59:33 PM12/28/09
to webdriver
Hey everybody. I'm trying to get text (Cyrillic) from webpage encoded
in UTF8. I'm using

driver.findElement(By.xpath(xPath)).getText()

which returns legible text if driver is FirefoxDriver but just
'?????????' if driver is WebRemoteDriver.

I found this while debugging:
// Force encoding as UTF-8.
byte[] bytes = json.toString().getBytes("UTF-8");
return new String(bytes, "UTF-8");

in AbstractExtensionConnection class for FirefoxDriver. And this

if (httpMethod instanceof PostMethod) {
((PostMethod) httpMethod)
.setRequestEntity(new StringRequestEntity(payload,
"application/json", "UTF-8"));
}

in HttpCommandExecutor class for WebRemoteDriver, but getText() uses
Get http method thus charset is not set in UTF8.
Isn't it customizing?

Simon Stewart

unread,
Dec 29, 2009, 8:22:23 AM12/29/09
to webd...@googlegroups.com
Sounds like we're not doing the right thing with remote webdriver.
Could you please open an issue for this so that we can track progress
on fixing this?

Regards,

Simon

> --
>
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
>
>
>

Daniel Wagner-Hall

unread,
Dec 29, 2009, 9:14:34 AM12/29/09
to webd...@googlegroups.com
Already filed - http://code.google.com/p/selenium/issues/detail?id=288

Star the issue to be notified of progress

Reply all
Reply to author
Forward
0 new messages