'Empty List is returning using selenium

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.common.keys import Keys

from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException

import pandas as pd

from bs4 import BeautifulSoup

import requests as r


import time

from selenium.webdriver.support.ui import Select

PATH="chromedriver.exe"


driver=webdriver.Chrome(PATH)

_list=[]

url=f"https://420love.ca/976-main-st-e/?dtche%5Bsearch%5D=&dtche%5Bcategory%5D=all"

driver.get(url)

driver.maximize_window()

WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, "age-gate-m")))

month=driver.find_element_by_id("age-gate-m")

month.send_keys("08")

day=driver.find_element_by_id('age-gate-d')

day.send_keys("19")

year=driver.find_element_by_id('age-gate-y')

year.send_keys("1996")

link=driver.find_element_by_xpath('/html/body/div[1]/div[3]/form/input[1]')

link.click()

time.sleep(4)




main_2=driver.find_elements_by_xpath('//*[@id="main-content"]/div[2]/div[1]/div[1]/a/div/div[1]')

_list.append(main_2)

print(_list)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source