I'm using the code below to find all the elements with class value = "ng_isolate_scope". What I would need to do though is to capture the tag value of the selected elements, since I need this information for further analysis
<span class="ng-isolate-scope">
<div class="ng-isolate-scope">
Code:
elems = driver.find_elements_by_class_name("ng-isolate-scope")
for elem in elems:
tag_value = elem.get_tag()
print("element found with tag value = " + str(tag_value))
However, tag_value() doesn't exist. What can I do to capture the tag value of an element? Thanks
updated: Its bit tricky, here my approach is to get outerHTML of element and then splitting the first word (which is tag name). So you can try:
elements = driver.find_elements_by_class_name("ng-isolate-scope")
for element in elements:
outerhtml = element.get_attribute('outerHTML ') // to extract outerHTML
tag_value=outerhtml.split('',1)[0] // to extract first word
print("element found with tag value = " + tag_value)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With