I have the following WebElement. How can I extract the latitude and longitude?
<span class="geotag" xmlns:geo="//www.w3.org/2003/01/geo/wgs84_pos#">
(<geo:lat>40.75198</geo:lat>,<geo:long>-73.96978</geo:long>)
</span>
I have the following WebElement. How can I extract the latitude and longitude?
<span class="geotag" xmlns:geo="//www.w3.org/2003/01/geo/wgs84_pos#">
(<geo:lat>40.75198</geo:lat>,<geo:long>-73.96978</geo:long>)
</span>
2
Answers
One way would be the following:
You select the element, then check which of the children is the latitude and which is the longitude. Then set the variables accordingly.
Of course, the selection of the element could be made easier, if it had a unique ID instead of only a class.
Check the below code with explanation:
Console output:
Imports required: