Reputation: 169
What is the best way to to select this element using Selenium WebDriver?
I am trying to access the <span>
element through the class mapResultNumber
. This is the actual HTML:
<div class="mapResultInner">
<div class="mapResultNumber">
<span>4</span>
</div>
Upvotes: 0
Views: 2056
Reputation: 1540
Using a css selector is a more readable way:
element = @driver.find_element(:css => "div.mapResultNumber span")
div.mapResultNumber > span
to indicate that the span tag is found directly beneath the divUpvotes: 0