webdriver getText returns String with leading and trailing whitespaces

External Issue #5569343


Nov 24, 2015
This issue is public.
Reported by 8 people

Sign in to watch or report this issue.

Steps to reproduce


Repro Steps:

<div id="test"> leading and trailing whitespaces </div>
WebElement test = driver.findElement(ById(“test”));
return test.getText();

Expected Results:

like described in the selenium documentation

Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace.

Actual Results:

Dev Channel specific:



0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Mara P.”

      Changed Assigned To from “Mara P.” to “Ben B.”

      Changed Status to “Confirmed”

      Changed Assigned To from “Ben B.” to “Reinhold D.”

      Changed Assigned To from “Reinhold D.” to “IE S.”

      Changed Status from “Confirmed” to “External”

    • We are also seeing this.

    • Is there any reason why this is an external issue?
      i am still seeing the same behaviour with 3.14393 and Selenium 2.53.0

    • Any updates on this issue? Seeing the same behavior with Selenium 3.0.1 and Selenium2Library 1.8.0. The issue is accurately described here: http://stackoverflow.com/questions/40000072/string-with-leading-and-trailing-whitespaces-on-using-gettext-method-with-micr

    • Having the same issue here any get text() returns useless spaces so I have to adjust every Java tests with .trim() only for this specific driver… Using Selenium 3.0.1 on Windows 10 Edge 14

    You need to sign in to your Microsoft account to add a comment.

    Sign in