If we had the following html,

<html>
...
<div value='1000'>what?</div>
</html>

we can extract ‘value’ attribute and innerhtml with the following sample python code.

element = driver.find_element_by_id('cityCode')

# get attribute named 'value'
value = element.get_attribute('value')  # 1000


# get inner html
innerhtml = element.get_attribute('innerHTML')  # 'what?'


0 Comments

Leave a Reply

Your email address will not be published.