Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Selenium webscrapping element

$
0
0

I am trying to do webscraping with Selenium (Python) from a website that has the following structure (I anonymized the html) but the GET part does not work..

I would like to retrieve the following information from the HTML :

  • INFO 1
  • INFO 2
  • INFO 3
  • TEXTE 1

Whenever I try the following code using XPATH it does not work :

code :

INFO_1= driver.find_elements(By.XPATH, "/html/body/div[1]/div/div/div[2]/section[2]/div[2]/div[1]/div/a/div[3]/div/span[1]")

HTML code :

<a href=" anonymized href " title=" **TITLE** " class="suggestion-link"><div><a href="#" style="display: inherit;"><span class="fav"></span></a></div> <div class="image-wrap"><!----> <!----> <!----> <!----> <!----> <!----> <div class="carousel"><span id="carousel_prev_8iikolcpmwi" style="display: none;"></span> <div id="carousel_o2u8ikkx7nl" class="owl-carousel owl-theme owl-loaded owl-drag"><div class="owl-stage-outer"><div class="owl-stage" style="transform: translate3d(0px, 0px, 0px); transition: all 0s ease 0s; width: 970px;"><div class="owl-item active" style="width: 323.242px;"><div class="item"><div class="filigrane"><img src="/images/filigrane.png"></div><div class="loaded">< anonymised.jpg" alt=" **TITLE 2**" class="img"> </div></div></div><div class="owl-item" style="width: 323.242px;"><div class="item"><div class="filigrane"><img src="/images/filigrane.png"></div><div class="loaded"><img src=" anonymized.jpg" alt=" **TITLE** " class="img"> </div></div></div><div class="owl-item" style="width: 323.242px;"><div class="item"><div class="filigrane"><img src="/images/filigrane.png"></div><div class="loaded"><img src=" anonymised.jpg" alt=" **TITLE** " class="img"> </div></div></div></div></div><div class="owl-nav disabled"><div class="owl-prev">next</div><div class="owl-next">prev</div></div><div class="owl-dots"><button role="button" class="owl-dot active"><span></span></button><button role="button" class="owl-dot"><span></span></button><button role="button" class="owl-dot"><span></span></button></div></div><span id="carousel_next_d6crxou5xy"></span></div></div><div class="content-wrap"><div class="card-top"><span class="card-left uppercase"> **INFO 1**</span> <span class="card-right"><!----> <!---->         **INFO 2**<!----></span></div><h3 class="title-wrap">**INFO 3**</h3><p class=""><span class="moreup"></span> **TEXT 1**.</p></div></a>

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>