Why do I get '0' response and some error when I try to scrape this site with selenium?

Question:

Hi I’m trying to scrape an ecommerce store ‘konga.com’ with selenium but when I try to get all the elements with with common class name, I get ‘0’ response and some error. here’s my code

from selenium import webdriver

import time

from selenium.webdriver.chrome.service import Service

from selenium.webdriver.common.by import By

url = 'https://www.konga.com/search?search=IPHONES'


service = Service(executable_path="C:/driver/chromedriver_win32/chromedriver.exe")

driver = webdriver.Chrome(service=service)

driver.get(url)

time.sleep(10)

driver.maximize_window()


product_cards = driver.find_elements(By.CLASS_NAME, 'bbe45_3oExY _22339_3gQb9')

time.sleep(10)
print(len(product_cards))

Here’s the error I get:

DevTools listening on ws://127.0.0.1:56835/devtools/browser/958d5a8b-268b-4699-8d41-fcd315cbb155

0

[12544:708:1027/102731.294:ERROR:gpu_init.cc(521)] Passthrough is not supported, GL is disabled, ANGLE is 

[5080:11512:1027/102831.450:ERROR:util.cc(129)] Can't create base directory: C:Program Files (x86)GoogleGoogleUpdater
Asked By: Miracle

||

Answers:

By.CLASS_NAME searches for one class at a time. This element you are looking for has two classes: bbe45_3oExY and _22339_3gQb9. Class names are separated by space inside the class attribute.
So in this case you can get the result you want using the command driver.find_elements(By.CLASS_NAME, 'bbe45_3oExY')

And concerning the question about the errors there is a post here

Answered By: Eugeny Okulik