空列表正在使用硒返回

发布于 2025-01-22 07:42:09 字数 1362 浏览 0 评论 0原文

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)
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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文