How to dump all attributes of an HTML element with WebDriver in Python?

3 views
Skip to first unread message

devIT

unread,
May 3, 2020, 11:01:48 PM5/3/20
to Europe-Job-Search
Dump Element Attributes with execute_script() in Python
Q

How to dump all attributes of an HTML element with WebDriver in Python?

✍: FYIcenter.com
A

The WebElement API provided in WebDriver offers only one method to retrieve the attribute value of a given attribute name using the get_attribute(name) method.

So there is no way to dump all attributes of an HTML element with the WebElement API, since you don't know what attributes are specified in the HTML element.

One way to solve the problem is to run a JavaScript code use the execute_script() method, as shown in the following example program.

please visit this Website.
http://sqa.fyicenter.com/1000462_Dump_Element_Attributes_with_execute_script_in_Python.html

Thank you,
Team SQAFYI - Software QA Resource FYI
http://sqa.fyicenter.com/
Reply all
Reply to author
Forward
0 new messages