'How to get the text if it is outside the tag in selenium?
<i class="icon solr-icon icon-ic-city"></i>"Solapur"
So I want to get the text with the help of i tag, but the problem is text "Pune" is out side the i tag. I can make use of li tag but I do not to do that. Can anyone tell me how to get text if the text is outside the tag?
Solution 1:[1]
I dont believe that there is a specific option to do this is selenium and you would have to select the enclosing element and then retrieve the innerHTML to get the source including the text you are interesed and then parse the source by most likely just removing the tag.
element.get_attribute('innerHTML')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
