I would like to print each merchant name next to "his" price of the page like this:
Climaconvenienza 1.031,79 €
Hwonline 1.031,80 €
Shopdigit 1.073,90 €
The code I made is this:
browser.get('https://www.trovaprezzi.it/televisori-lcd-plasma/prezzi-scheda-prodotto/lg_oled_cx3?sort=prezzo_totale')
wait = WebDriverWait(browser, 10)
wait.until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, ".merchant_name_and_logo img")))
wait.until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, ".merchant_name_and_logo img")))
names = browser.find_elements_by_css_selector(".merchant_name_and_logo img")
for span in names:
print(span.get_attribute("alt"))
all_divs = browser.find_elements_by_xpath("//div[@class='item_total_price']")
for div in all_divs:
print(div.text)
But, by running my code, I get this:
Climaconvenienza
Hwonline
Shopdigit
1.031,79 €
1.031,80 €
1.073,90 €
source https://stackoverflow.com/questions/67765096/need-help-using-selenium-chromedriver-and-python
Comments
Post a Comment