I have been trying to scrape some products online, but when I try and print the title from an A tag it gives me this output:
<selenium.webdriver.remote.webelement.WebElement (session="48e7924c296324a7a5a843d9ccab36fb", element="b8871651-23af-42c6-a49a-5b93fe932653")>
Now this is my code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pandas as pd
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://egypt.souq.com")
dotd = "/html/body/div[2]/div/main/div[1]/div[1]/div/div[1]/a/img"
driver.find_element_by_xpath(dotd).click()
def get_deals():
title_xpath = "/html/body/div[1]/div/main/div/div[4]/div[3]/div[2]/div[1]/div[1]/div/div[2]/ul/li[1]/h6/span/a"
titles = driver.find_elements_by_xpath(title_xpath)
for title in titles:
print(title)
get_deals()
print("successful")