FindElement with xPath does not work properly - contains @class

Issue #8503401 • Assigned to Travis L.


Christiane S.
Aug 16, 2016
This issue is public.
Reported by 3 people

Sign in to watch or report this issue.

Steps to reproduce

If you try to find an element with xPath where you search a substring of the class the element can not be found.


<div class="foo-bar test">

This does not work:
Driver.FindElement(By.xpath("//div[contains(@class, ‘foo’)]"))

This works:
Driver.FindElement(By.xpath("//div[contains(@class, ‘foo-bar’)]"))


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Brad E.”

      Changed Assigned To to “Travis L.”

    • i have around 12 automation scenarios all work fine in other browsers like Chrome, in Edge they all fail because of the xpath locators do not work in Edge.

      trying to narrow down the discrepancy with edge, any suggestions ???

      environment details:
      Edge driver 2.0 windows 10 enterprise, version 1511, os build 10586.679

    • I have the same issue.

      This doesn’t work either.
      Driver.FindElement(By.xpath("//div[contains(@class, ‘foo-bar test’)]"))

      But these are fine.
      Driver.FindElement(By.xpath("//div[@class=‘foo-bar test’]"))

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

    Sign in