get attribute/inner html of html element in python selenium
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?'