【发布时间】:2021-02-19 11:12:24
【问题描述】:
当我尝试使用以下 xpath 查找元素时,出现语法错误,这可能是什么原因,我正在关注这个问题,但它对我不起作用
https://stackoverflow.com/a/58400631/12849200
我的 Xpath:
dp_month = driver.find_element_by_xpath('//*/td[@aria-label='+month_label+']/div[contains(text(),'+ x_month +')]')
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //*/td[@area-label=November 2025]/div[contains(text(),NOV)] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*/td[@area-label=November 2025]/div[contains(text(),NOV)]' is not a valid XPath expression.
【问题讨论】:
标签: selenium selenium-webdriver