FindElement by xPath does not find elements when contains @class is used for two clases.

Issue #8516233


Aug 17, 2016
This issue is public.
Found in
  • Microsoft Edge
Found in build #
Reported by 9 people

Sign in to watch or report this issue.

Steps to reproduce

Finding element by xPath "contains(@class, ‘home-page new-topbar’) containg two clases separated by space ends with Exception:

Exception in thread "main" org.openqa.selenium.WebDriverException: Unknown error
Command duration or timeout: 663 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'tancer-pc', ip: '', 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_11'
Driver info: org.openqa.selenium.edge.EdgeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(
    at org.openqa.selenium.remote.RemoteWebDriver.execute(
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(
    at org.openqa.selenium.edge.EdgeDriver.<init>(
    at org.openqa.selenium.edge.EdgeDriver.<init>(
    at org.openqa.selenium.edge.EdgeDriver.<init>(

Working example:

public static void main(String[] args) {
        System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe");
        WebDriver driver = new EdgeDriver();

        String xpath = "//body[contains(@class, 'home-page new-topbar')]";

        boolean isDisplayed = driver.findElement(By.xpath(xpath)).isDisplayed();



Tested also on FF and Chrome and no problem there.


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Ibrahim O.”

      Changed Assigned To to “Mara P.”

      Changed Assigned To to “Rico M.”

      Changed Assigned To from “Rico M.” to “Travis L.”

      Changed Assigned To from “Travis L.” to “Thomas M.”

      Changed Assigned To from “Thomas M.” to “Eugene V.”

      Changed Status to “Confirmed”

    • running into the same problems with xpath locators in Edge, windows 10 enterprise, version 1511, os build 10586.679

      any suggestions

    • I am also Facing similar issue, Is there a workaround for this available currently?

    • I am also having problems with the newest insider Driver (10.0.16199.1000). Is there a solution on how to fix this?

    • I am also having the same problems with the newest Driver, been over a year without any movement. Can we get a status update on this?

    • Microsoft Edge Team

      Changed Status from “Confirmed”

    • This bug has marked as duplicate. Please follow the parent issue to get new updates.

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

    Sign in