AJJ
AJJ

Reputation: 3628

Selenium findElement not working for google maps

Could not able to find an element inside the google map.

<g-map id="map-contain" style="position: relative; overflow: hidden; transform: translateZ(0px); background-color: rgb(229, 227, 223);">
    <div class="gm-style" style="position: absolute; left: 0px; top: 0px; overflow: hidden; width: 100%; height: 100%; z-index: 0;">
        :::::
        ::::::
        ::::::
    </div>
<g-map>

I tried with this with no luck to select the div with class 'gm-style'

this.driver.findElement(By.xpath('//div[@class="gm-style"]'));

How can i get an element inside the g-map tag?

Upvotes: 0

Views: 254

Answers (1)

Joern Boegeholz
Joern Boegeholz

Reputation: 591

I would try matching the outside g-map tag via id and get its children. Ids should be unique while classes are mostly not

Upvotes: 1

Related Questions