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;
}
CodePudding user response:
The locator you have used:
//*[contains(@class,'v-label v-label--active theme--light primary--text') and contains(text(),'Narystė')]
is essentially an xpath but not a css-selectors
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ė')]");