0

I want to get latitude (60.92804) and longitude(76.63186) from yandex map on a web, the element in below What is xpath for it ?

<div class="b-search-map expanded item-map-wrapper js-item-map-wrapper" data-map-zoom="16" data-map-lat="60.92804" data-map-lon="76.63186" data-map-type="dynamic" data-show-neighbour="" data-item-id="1832857879" data-location-id="660480" data-category-id="24" data-shop-id="138733" data-add-params="{&quot;params[549]&quot;: &quot;5696&quot;,&quot;params[201]&quot;: &quot;1059&quot;}"><div class="styles-root-1ru5P styles-root_shadow-1gYXt" data-marker="map-full"><div class="map-root-1eDWx" style="height: 380px;"><ymaps class="ymaps-2-1-75-map" style="width: 636px; height: 379px;"><ymaps class="ymaps-2-1-75-map ymaps-2-1-75-i-ua_js_yes ymaps-2-1-75-map-bg ymaps-2-1-75-islets_map-lang-ru" style="width: 636px; height: 379px;"><ymaps class="ymaps-2-1-75-inner-panes"><ymaps class="ymaps-2-1-75-events-pane ymaps-2-1-75-user-selection-none" unselectable="on" style="height: 100%; width: 100%; top: 0px; left: 0px; position: absolute; z-index: 2500; cursor: url(&quot;https://enterprise.api-maps.yandex.ru/2.1.75/build/release/images/cursor/grab.cur&quot;) 16 16, url(&quot;https://enterprise.api-maps.yandex.ru/2.1.75/build/release/images/cursor/grab.cur&quot;), move;"></ymaps><ymaps class="ymaps-2-1-75-ground-pane" style="top: 0px; left: 0px; position: absolute; transform: translate3d(0px, 0px, 0px) scale(1, 1); z-index: 501;"><ymaps style="z-index: 150; position: absolute;"><canvas height="635" width="892" style="position: absolute; width: 892px; height: 635px; left: -128px; top: -128px;"></canvas></ymaps></ymaps><ymaps class="ymaps-2-1-75-copyrights-pane" style="height: 0px; bottom: 0px; right: 0px; top: auto; left: 0px; position: absolute; z-index: 5002;"><ymaps><ymaps class="ymaps-2-1-75-copyright" style=""><ymaps class="ymaps-2-1-75-copyright__fog">…</ymaps><ymaps class="ymaps-2-1-75-copyright__wrap"><ymaps class="ymaps-2-1-75-copyright__layout"><ymaps class="ymaps-2-1-75-copyright__content-cell"><ymaps class="ymaps-2-1-75-copyright__content"><ymaps class="ymaps-2-1-75-copyright__text">© Яндекс</ymaps><ymaps class="ymaps-2-1-75-copyright__agreement">&nbsp;<a class="ymaps-2-1-75-copyright__link" target="_blank" href="https://yandex.ru/legal/maps_termsofuse/?lang=ru">Условия использования</a></ymaps></ymaps></ymaps><ymaps class="ymaps-2-1-75-copyright__logo-cell"><a class="ymaps-2-1-75-copyright__logo" href="" target="_blank"></a></ymaps></ymaps></ymaps></ymaps></ymaps></ymaps><ymaps class="ymaps-2-1-75-controls-pane" style="width: 100%; top: 0px; left: 0px; position: absolute; z-index: 4503;"><ymaps class="ymaps-2-1-75-controls__toolbar" style="margin-top: 10px;"><ymaps class="ymaps-2-1-75-controls__toolbar_left"></ymaps><ymaps class="ymaps-2-1-75-controls__toolbar_right"></ymaps></ymaps><ymaps class="ymaps-2-1-75-controls__bottom" style="top: 379px;"></ymaps></ymaps><ymaps class="ymaps-2-1-75-places-pane" style="top: 0px; left: 0px; position: absolute; transform: translate3d(0px, 0px, 0px) scale(1, 1); z-index: 2004;"><ymaps class="ymaps-2-1-75-placemark-overlay ymaps-2-1-75-user-selection-none" unselectable="on" style="z-index: 400; height: 0px; width: 0px; position: absolute; left: 318px; top: 190px;"><ymaps><div class="map-pin-w-1Mx6H map-selected-31tN1">
        <div class="map-pin-1Nvku map-selected-31tN1" data-marker="map-pin"><span></span></div>
    </div></ymaps></ymaps></ymaps></ymaps></ymaps></ymaps></div><div class="control-buttons-root-3MQBN"><div class="control-buttons-controls-15QLU"><div class="control-buttons-zoom-buttons-_RU0s"><button class="control-buttons-control-button-ukLHD control-buttons-zoom-button_in-1W229" type="button" data-marker="map-zoom-button_in"></button><hr class="control-buttons-delimeter-row-1Dvsp"><button class="control-buttons-control-button-ukLHD control-buttons-zoom-button_out-3Uc97" type="button" data-marker="map-zoom-button_out"></button></div><button class="control-buttons-control-button-ukLHD control-buttons-geolocation-1h881 control-buttons-geolocation_background-BfSoh" type="button" data-marker="map-my-geolocation"></button></div></div></div></div>
  • 1
    You're more likely to find someone prepared to help you if (a) you make the HTML legible, and (b) you say what you've already tried. – Michael Kay Feb 23 '20 at 11:10
  • Thanks Michael Kay, I tried scraping data on this site https://www.avito.ru/mahachkala/kvartiry/2-k_kvartira_71_m_210_et._1863884263 I tried //div[@class="b-search-map expanded item-map-wrapper js-item-map-wrapper" and contains(text(), 'data-map-lat)] but not work – HieuTran Feb 23 '20 at 12:10
  • I'm just passing through for review. @HieuTran, have you tried to use Chrome feature to get xpath - https://stackoverflow.com/questions/3030487/is-there-a-way-to-get-the-xpath-in-google-chrome – mjabadilla Feb 23 '20 at 18:29

1 Answers1

0

Sorry, but I don't see these tags on this link. In any case, "data-map-lat" is a property of the class and You need to work with it as with the @data-map-lat property. For example: Best way to get text of this element in selenium or Capybara: is it possible to get an attribute value from a css string?

Vitalii
  • 113
  • 1
  • 1
  • 11