-
Notifications
You must be signed in to change notification settings - Fork 0
/
selenium_1.py
40 lines (28 loc) · 1013 Bytes
/
selenium_1.py
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
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("https://ruzan.ru/woman/women-s-purse-michael-kors-blue")
color_btn = driver.find_element(By.CSS_SELECTOR, "label img.img-thumbnail")
color_btn.click()
text_elem = driver.find_element(By.NAME, "quantity")
text_elem.clear()
text_elem.send_keys("22")
btn_add = driver.find_element(By.CSS_SELECTOR, "a#button-cart")
btn_add.click()
btn_qooci = driver.find_element(By.ID, "oct-policy-btn")
btn_qooci.click()
# driver.implicitly_wait(3)
AAA = driver.find_element(By.CSS_SELECTOR, "button#cls.testbutton")
AAA.click()
cart_btn = driver.find_element(By.ID, "cart")
cart_btn.click()
BBB = driver.find_element(By.LINK_TEXT, "Открыть корзину")
BBB.click()
assert "Кошелек женский Michael Kors синий" in driver.page_source
print("OK")
time.sleep(5)
driver.close()
driver.quit()