-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct_request.py
More file actions
32 lines (23 loc) · 939 Bytes
/
Copy pathProduct_request.py
File metadata and controls
32 lines (23 loc) · 939 Bytes
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
import time
from fake_useragent import UserAgent
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
options = webdriver.ChromeOptions()
options.add_argument(f"user-agent={UserAgent().random}")
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
def find_p(message):
url = "https://tarkov-market.com/ru/"
string = message.text.replace(' ', '_').replace('-', '_').replace(' ', '_')
try:
driver.get(url)
time.sleep(2)
string_input = driver.find_element_by_xpath('//*[@id="__layout"]/div/div/div/div[2]/div[1]/input')
time.sleep(5)
string_input.clear()
string_input.send_keys('pass')
time.sleep(5)
soup = BeautifulSoup(driver.page_source, 'lxml')
block_things = soup.find(class_="cards-list").find_all("div")[1:]
except Exception as ex:
print(ex)