1

I want to fine this WebElement:

<div class="title_bar bar ng-sss" ng-rr="!isBulkMode">

So when using CSS:

div[class=title_bar bar ng-sss]

This element could not found.

And with Xpath this works:

//div[@class='title_bar bar ng-sss']
4
  • Cause the css is wrong. Commented Feb 25, 2016 at 11:48
  • Why wrong ? can you show example ? Commented Feb 25, 2016 at 11:51
  • 1
    Try div.title_bar.bar.ng-sss Commented Feb 25, 2016 at 12:00
  • There is no such thing as "class with space in the name"! It is a space-separated list of classes. Commented Feb 25, 2016 at 15:46

1 Answer 1

2

You don't have apostrophes in the cssSelector

By.cssSelector("div[class=`title_bar bar ng-sss`]");

You also don't have to use square brackets when using cssSelector

By.cssSelector("div.title_bar.bar.ng-sss`]");
// or
By.cssSelector(".title_bar.bar.ng-sss`]");

Dot before the name represents class name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.