我正在尝试从包含JavaScript内容的页面中抓取数据.例如,我想要的内容采用以下格式:
<span class="class">text</span>
...
<span class="class">more text</span>
Run Code Online (Sandbox Code Playgroud)
我使用了该find_element_by_xpath(//span[@class="class"]').text函数但它只返回了指定类的第一个实例.基本上,我想要一个像这样的列表[text, more text].我找到了这个find_elements_by_xpath()函数,但.text最后会导致错误exceptions.AttributeError: 'list' object has no attribute 'text'.