1

enter image description here

In screen you can see, that entered selector is only one.

Here is code, where I have entered the same selector, but getting error like this:

Element info: {Using=css selector, value=//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]}
Find element :By.cssSelector: //*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]
Get Exception: invalid selector: An invalid or illegal selector was specified

Code trils:

private static final By naryste = By.cssSelector("//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]");
    @Step("Pasirenkame juridinio asmens organizaciją iš reikšmių sąrašo")
    public createOrganization selectMembership() {
        button.click(naryste);
        return this;
    }

1 Answer 1

1

The locator you have used:

//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]

is essentially an but not a

You need to change:

By.cssSelector("//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]");

As:

By.xpath("//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]");
Sign up to request clarification or add additional context in comments.

2 Comments

thank you for answer. But selenium can't find this xpath: Find element :By.xpath: //*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')] Find element :By.xpath: //*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]
@Jetz That should a different error and a different question all together. Feel free to raise a new question with your new requirement please.

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.