I’m trying to obtain a value from Google Shopping and have attempted to use CSS, className, and XPath.
However, nothing seems to work and it always returns an empty value. As you can see from the print, I have the exact class and CSS name, and still, I can’t get it to work. Has anyone who uses Selenium encountered something like this?
sleep(5)
preco_itens = driver.find_elements(By.XPATH, "//span[contains(@class, 'a8Pemb') and contains(@class, 'OFFNJ')]")
Html of the page
I tried using CSS, and it still returns empty.
preco_itens = driver.find_elements(By.CSS_SELECTOR, “span.a8Pemb.OFFNJ”)
Pablo Fernandes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.