I'm having difficulty getting text between span tags. The problem is that the said text is not written in Latin Alphabet.

I have no problems using UTF text as part of xpath locator. My xpath looks like this: //span[starts-with(., 'Пријем')]

Selenium finds that element, clicks on it, but when I want to retrieve text from that span I get ?????? ?????? ??????????.

The spanin question looks like this:

<span class="ui-menuitem-text">Активне резервације</span>

I'd really appreciate a bump in the right direction.

  • What happens if you try to compare the element text with Активне резервације? Assert.assertEquals(element.getText(), "Активне резервације") – João Farias Aug 20 '19 at 12:44
  • It asserts to true. I've managed to change Eclipse environment encoding to UTF-8, I'm struggling with TestNG. If I change the expectedcondition the test fails but the trace is not in UTF but an incomprehensible mess... – Nikola Pepic Aug 20 '19 at 13:47
  • If the assert passes, it means the problem is only configuration of your env to display the text - the Selenium code is working properly. I'm voting to close the question as unrelated to testing then. – João Farias Aug 21 '19 at 7:03
  • 4
    I'm voting to close this question as off-topic because the problem is environment configuration, not testing. – João Farias Aug 21 '19 at 7:03