-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodo.py
More file actions
66 lines (57 loc) · 1.72 KB
/
Copy pathtodo.py
File metadata and controls
66 lines (57 loc) · 1.72 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ukazka.ru
class Partsdirect(Shop):
def __init__(self, driver):
Shop.__init__(
self, driver,
"https://ekb.partsdirect.ru",
"/search_results?sort=inexpensive&q=%s",
"/basket"
)
class Intelekt(Shop):
def __init__(self, driver):
Shop.__init__(
self, driver,
"https://www.intel-ekt.ru/",
"catalog/search/?keyword=%s",
"/order/"
)
class Nix(Shop):
def __init__(self, driver):
Shop.__init__(
self, driver,
"https://e-burg.nix.ru",
"/price/search_panel_ajax.html#t:goods;k:%s",
"/scripts/order_cb.html"
)
class Dns(Shop):
def __init__(self, driver):
Shop.__init__(
self, driver,
"https://www.dns-shop.ru",
"/search/?q=%s",
"/order/begin/"
)
class Eldorado(Shop):
def __init__(self, driver):
Shop.__init__(
self, driver,
"https://www.eldorado.ru",
"/search/catalog.php?sort=price&type=ASC&q=%s",
"#listing-container > ul",
"/personal/basket.php"
)
def _get_all_product_elements(self):
return self.driver.find_elements(By.CSS_SELECTOR, "#listing-container > ul > li")
def _product_factory(self, element):
return EldoradoProduct(element)
class EldoradoProduct(SimpleProduct):
def __init__(self, element):
SimpleProduct.__init__(
self, element,
"[data-dy='title']",
"[data-pc='offer_price']",
"button[data-dy='button']"
)
WebDriverWait(element, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, name_selector)))
WebDriverWait(element, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, price_selector))),
WebDriverWait(element, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, cart_button_selector)))