-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpart_2.py
More file actions
43 lines (36 loc) · 1.52 KB
/
Copy pathpart_2.py
File metadata and controls
43 lines (36 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import 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
import time
def Search_bar():
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.pakwheels.com/")
# try:
# cookies = driver.find_element(By.XPATH, '//button[@id="onesignal-slidedown-allow-button"]').click()
# except NoSuchElementException as e:
# print("Erro_1", e)
year_of_model = driver.find_element(By.ID, "home-query")
year_of_model.click()
year_of_model.send_keys("2015")
search_button = driver.find_element(By.ID, "home-search-btn")
search_button.click()
try:
year_from = driver.find_element(By.ID, 'yr_from')
year_from.send_keys("2015")
year_from.send_keys(Keys.ENTER)
year_to = driver.find_element(By.ID, 'yr_to')
year_to.send_keys("2015")
year_to.send_keys(Keys.ENTER)
clk = driver.find_element(By.ID, 'yr-go')
clk.click()
except NoSuchElementException as e:
print("Error", e)
Search_bar()