【发布时间】:2022-01-17 21:26:54
【问题描述】:
'''蟒蛇''' 从硒导入网络驱动程序 从 webdriver_manager.chrome 导入 ChromeDriverManager 从 selenium.webdriver.common.by 导入 从 selenium.webdriver.chrome.service 导入服务 从 selenium.webdriver.common.keys 导入密钥 从 selenium.common.exceptions 导入 NoSuchElementException 从 selenium.common.exceptions 导入
ElementNotInteractableException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains
import time
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.pakwheels.com/")
print(driver.title)
year_of_model=driver.find_element(By.ID,"home-query")
year_of_model.send_keys("2015")
search_button=driver.find_element(By.ID,"home-search-btn")
search_button.click()
colour = driver.find_element(By.XPATH, '//*[@id="collapse_16"]/div/ul/li[1]//a/input')
driver.execute_script("arguments[0].click();", colour)
try:
From_year = driver.find_element(By.ID, "yr_from")
To_year = driver.find_element(By.ID, "yr_to")
From_year.send_keys("2015")
To_year.send_keys("2015")
go = driver.find_element(By.ID, "yr-go").click()
except ElementNotInteractableException as e:
print(f"The Error is:{e} ")
time.sleep(30)
我觉得少了点什么
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver web-scraping