this post was submitted on 12 Oct 2024
2 points (100.0% liked)

Selenium Web Browser Automation

101 readers
4 users here now

Users forum for selenium browser testing. Do not advertise here.

founded 2 years ago
MODERATORS
 

I'm trying to get images from a duckduckgo search, this is my function currently

def search(query):
    driver.get(f"https://duckduckgo.com/?q={query}&iax=images&ia=images")
    res = driver.find_elements(By.CLASS_NAME, "tile--img__img")
    while True:
        logger.debug(res)
        if len(res) == 0:
            time.sleep(1)
        else:
            break
            logger.info("Results pulled")

But no matter how long it waits, res always returns empty, and when I tried to do the same with find_element I got a nonexistent element error.

Inspect element on one of the images:

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here