2

im facing an issue regarding the xpath trying to get value of chinese characters and return the value was alien value of chinese value. Kindly advise . Indeed i had change the encoding to UTF-8 hence its still not working. I try to set a log on the string Str , as the value of str are "???".

CODE :

String str = new String("三连号".getBytes(), "UTF-8");

WebDriverWait wait = new WebDriverWait(driver, 60);
                element = wait
                        .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[@class='content' and contains(text(),'"+str+"')]")));
Jayden Ng
  • 141
  • 1
  • 1
  • 14
  • take a look at : http://stackoverflow.com/questions/9787862/character-encoding-issues-in-eclipse-for-java-using-webdriver –  Jun 03 '16 at 09:12
  • There's not need to encode the characters, `By.xpath("//*[text()='三连号']")` works fine with Firefox and Chrome. The issue is with the encoding of your file, IDE or JVM. – Florent B. Jun 03 '16 at 09:19

0 Answers0