I use Selenium 2.35.0, latest Firefox, and Linux OS.
I unable to use regular expression in my java application.
I have a line like this:
Iterator<WebElement> iterator =
driver.findElements(By.xpath("//a[matches(@href, 'site.ru/[0-9]*/')]")).iterator();
Exception occured:
org.openqa.selenium.InvalidSelectorException: The given selector //a[matches(@href, "site.ru/[0-9]/")] is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression //a[matches(@href, "site.ru/[0-9]/")]
Could you please help me with investigation reason of this fault?
matches()function already matches if the regex exists anywhere in the string.