I am trying to find the names of all iframes in a web page. When I run driver.find_element_by_xpath("//iframe")
I get session="f139d552bcf5b17598ba7b5af3987c8", element="04036644-d6cf-40a1-9434-5ce5d951e9a"
how do I correlate this back to a name that is useful in html so that I can switch by different locators like tag, css, id, etc.? Preferably not in Java but if that is the only solution available that's fine. What kind of Id /attribute is element="04036644-d6cf-40a1-9434-5ce5d951e9a". Can someone provide an example of what the code would look like?
Asked
Active
Viewed 23 times
0

user14048672
- 1
- 1
-
you can return the attribute of the iframe element using get_Attribute() method. In this case, you can return the tag, id , class or any attribute value on the element. – Sureshmani Kalirajan Aug 27 '20 at 18:32
-
driver.find_element_by_xpath("//iframe").get_attribute("name"), get_attribute("id") etc. – rahul rai Aug 28 '20 at 12:51
-
Does this answer your question? [How to get attribute of element from Selenium?](https://stackoverflow.com/questions/30324760/how-to-get-attribute-of-element-from-selenium) – rahul rai Aug 28 '20 at 12:52
-
Do you have an example of what the code snippet would look like and what the expected result would be? – user14048672 Aug 31 '20 at 14:43
-
This example helped me thank you very much – user14048672 Sep 01 '20 at 15:42