Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97790

Extract Element from Python Scrape

$
0
0

Hello World,

Currently trying to extract information from a webpage with python (shown below), I am having some issue.

enter image description here

Below is the Code that I have to extract content of the page:

from selenium import webdriver
from selenium.webdriver.common.proxy import *
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time

binary = r'C:\Users\mrg720\AppData\Local\Mozilla Firefox\firefox.exe'
gecko = r'C:\Users\mrg720\AppData\Local\Continuum\anaconda3\geckodriver.exe'

options = Options()
options.set_headless(headless=False)
options.binary = binary

cap = DesiredCapabilities().FIREFOX
cap["marionette"] = True #optional


title =[]
price=[]
localisation=[]
date=[]

driver = webdriver.Firefox(firefox_options=options, capabilities=cap, executable_path= gecko)
driver.maximize_window() 
driver.implicitly_wait(15) 

for i in range(1,2):
    driver.get('https://www.leboncoin.fr/ventes_immobilieres/offres/ile_de_france/p-'+str(i)+'/')
    time.sleep(15)
    print(driver.page_source)

If anyone has a suggestion to retrieve those specific information, it will be helpful.

Expected output:

df

title                      Price     Localisation           Date
Maison 10 piece 260m       735000    Bessancourt 95550      Aujourd'hui 10:36
URGENT investisseur.       190000    CorbeilEssone 91100    Aujourd'hui 10:36
.....

Thanks for everyone helping!


Viewing all articles
Browse latest Browse all 97790

Trending Articles



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