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

Duplicate Issue #8516233 • See Issue #8503401

Details

Author
T.
Created
Aug 17, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Duplicates
See progress on Bug #8503401
Found in build #
10
Reports
Reported by 8 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: '192.168.64.143', os.name: '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(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:98)

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();
        driver.get("https://stackoverflow.com/");

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

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

        System.out.println(isDisplayed);

        driver.close();
    }

Tested also on FF and Chrome and no problem there.

Attachments

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” to “Duplicate”

    • 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