最佳答案
在 Python Selenium 模块中,一旦我有了一个 WebElement对象,我就可以用 get_attribute()获得它的任何属性的值:
foo = elem.get_attribute('href')
如果名为 'href'的属性不存在,则返回 None。
我的问题是,如何获得一个元素具有的所有属性的列表?似乎没有 get_attributes()或 get_attribute_names()方法。
我使用的是针对 Python 的 Selenium 模块的2.44.0版本。