Splinter find_by_xpath: using regex for element text() Splinter find_by_xpath: using regex for element text() selenium selenium

Splinter find_by_xpath: using regex for element text()


Both latest Firefox and Chrome don't support XPath 2.0. Here are the relevant open issues:

You have to approach it without using matches(). For instance, you may filter the list of tr you find in Python by taking the EAFP approach and using datetime.strptime(). Sample:

from datetime import datetimefor tr in browser.find_by_tag("tr"):    sorted_on = tr.find_by_css(".sorted-on")    try:        datetime.strptime(sorted_on.text, "%B %d, %Y")    except ValueError:        continue