1

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.

3
  • 3
    Are you sure your terminal (or whatever you are using for output) is capable of printing currency symbols correctly?
    – user246
    Jul 8 '14 at 19:41
  • Thanks. It worked after changing the console encoding to UTF-8
    – STE
    Jul 9 '14 at 14:51
  • Don't forget to accept an answer if you found it helpful. =)
    – corsiKa
    Nov 10 '14 at 19:55
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());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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