2

I am using selenium to test our software, but I have run into a problem. There is a button like this :

<button data-action="show-more" class="btn btn-link btn-invisible more padded">Viac potenciálne zmluvy...</button>

And I am trying to select it with

$this->webDriver->findElement(WebDriverBy::cssSelector("btn.btn-link.btn-invisible.more.padded"));

And it just doesn't work. I have tried deleting some of the classes or using className - still nothing.

What am I doing wrong ?

Thank you very much

2 Answers 2

2

The first part of your selector is "btn" which is a class so it should be ".btn". I would go one step further and add the tag name to the front to make it a little more specific which would make the selector:

"button.btn.btn-link.btn-invisible.more.padded"
Sign up to request clarification or add additional context in comments.

1 Comment

nice answer, awesome
2

I think using following cssSelector would be more specific to locate desire element as :-

$this->webDriver->findElement(WebDriverBy::cssSelector("button.btn.btn-link.more[data-action='show-more']"));

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.