Python Selenium SyntaxError:无法在'Document'上执行'evaluate':字符串'// div [contains@class,'product-card__subtitle'

试图获取div类的XPath和div内部的文本。两个div是:

<div class="product-card__subtitle">Women's Shoe</div>
<div class="product-card__subtitle">Men's Shoe</div>

给出硒错误的我的Xpath是:

driver.find_element_by_xpath("//div[contains(@class,'product-card__subtitle') and text("
                                                      ")='Women's Shoe']")

driver.find_element_by_xpath("//div[contains(@class,'product-card__subtitle') and text()='Men's "
                                                    "Shoe']")

我正在尝试查找表示“女鞋”的部分的路径,以及查找表示“男鞋”的部分的路径。

pic

相关文章

我最近重新拾起了计算机视觉,借助Python的opencv还有face_r...
说到Pooling,相信学习过CNN的朋友们都不会感到陌生。Poolin...
记得大一学Python的时候,有一个题目是判断一个数是否是复数...
文章目录 3 直方图Histogramplot1. 基本直方图的绘制 Basic ...
文章目录 5 小提琴图Violinplot1. 基础小提琴图绘制 Basic v...
文章目录 4 核密度图Densityplot1. 基础核密度图绘制 Basic ...