el_list = driver.find_elements('xpath', '//*[@id="_id_pieGrid0"]').get_attribute('outerHTML')
时间: 2024-02-05 14:03:20 浏览: 70
xpath_helper_2.0.2.rar
As an AI language model, I cannot determine the exact context of your code. However, I noticed that there is an error in your code.
`find_elements` method returns a list of web elements, even if there is only one matching element. Therefore, you cannot directly call the `get_attribute` method on a list. Instead, you need to loop through the list and call `get_attribute` method on each element.
Here's an updated code snippet that should work:
```
el_list = driver.find_elements_by_xpath('//*[@id="_id_pieGrid0"]')
for el in el_list:
outerHTML = el.get_attribute('outerHTML')
# do whatever you want with the outerHTML variable
```
Please note that you may need to modify the XPath expression to match your specific use case.
阅读全文