'Using Selenium Java get special characters (Chinese, Japanese) but gives?
I have a requirement where I would like to read combination of English and non English characters from a dropdown on Web UI Example- abcd , efgh, 你好, こんにちは
public void test(){
dropdown.click();
Select newValues = new Select(dropdown);
List<WebElement> listNewValues = countryValues.getOptions();
ArrayList<String> actualDropDownItems = new ArrayList();
for(WebElement value : listNewValues){
actualDropDownItems.add(value.getText());
System.out.println(value.getText().toString());
}
If I try to run and print this, I get ?? for Chinese and Japanese values. Please note I have read some of the previous suggestions and in eclipse at project> properties level> Resource> Other is set to UTF-8. Everywhere it is suggested to use UTF-8. But what else can I do If I have already set this at project properties level.
Is there any other easier way of getting this non-English characters? Any help is appreciated.
P.S. I had also tried using BufferedWriter approach, but it gives me å›½æ—¥æœ¬ëŒ€í•œë¯¼êµ instead of 你好, こんにちは
Solution 1:[1]
Running simple System.out.println("??"); was not giving me correct output on Eclipse console. Looks like setting eclipse at project level was not doing anything to help me. project> properties level> Resource> Other is set to UTF-8
Did right click on test, Coverage As> Coverage configuration > Common and then set Other to UTF-8, solved my problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | stuart |
