asking for Selenium *find_element_by_class_name



我曾试图从有用和无用的按钮获取文本,但未能成功:

例如:我想得到";6013";以获得有用的观点和";320〃;对于没有帮助的点:

我的代码是:

product_helpful.append(container.find_element_by_class_name('css-0').text)    
product_not_helpful.append(container.find_element_by_class_name('css-0').text)

你可以查看图片以供参考:

在此处输入图像描述

使用title属性来针对代码中有用与无用的部分

product_helpful.append(container.find_element_by_css_selector('[title="Helpful"] span').text)    
product_not_helpful.append(container.find_element_by_css_selector('[title="Unhelpful"] span').text)

请注意,为此必须使用WebElement中的find_element_by_css_selector方法。

最新更新