Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

In Dropdown currencies are listed as($,€,₤). Based on the selected currency, prices will display in other page like ($10,€10,₤10). Using the below code, I got the selected value from the dropdown.

    WebElement select=driver.findElement(By.className("selected"));
    select.getText();
    System.out.println("Currency Selected:" +select.getText());

When I print the value its coming as ? instead of $. How to print the currency value. And check whether the $ currency is displaying in other page.

share|improve this question
3  
Are you sure your terminal (or whatever you are using for output) is capable of printing currency symbols correctly? –  user246 Jul 8 at 19:41
    
Thanks. It worked after changing the console encoding to UTF-8 –  sathiya Jul 9 at 14:51

1 Answer 1

Instead of simple System.out.println (last line in your example)

try out the following:

PrintStream out = new PrintStream(System.out, true, "UTF-8");
out.println("Currency Selected:" +select.getText());
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.