空列表正在使用硒返回
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论