Using splinter is there a simple way to get access to the HTML attributes of a WebDriverElement
>>> from splinter import Browser
>>>
>>> browser = Browser('firefox')
>>> browser.visit('http://lovdtest.mcri.edu.au/individuals/00000143')
>>> imgs = browser.find_by_tag('img')
[<splinter.driver.webdriver.WebDriverElement object at 0x1de2610>, <splinter.driver.webdriver.WebDriverElement object at 0x1de2690>]
I can get individual attributes by doing this (eg, imgs[0]['src']
, imgs[0]['alt']
) but there does not seem to be a keys() or items() method implemented in the WebDriverElement class.
imgs[0].__dict__
contains values that are unrelated to the HTML attributes.
{'action_chains': , '_element': , 'parent': }
What can I do to get a dictionary with information on the HTML attributes of imgs[0]?
{"src": "gfx/header1.png", "alt": "Logo", "width": "172",
"height": "31", "id": "site_logo", "style":
"margin-top : 5px; cursor : pointer;"}