from selenium import webdriver from selenium webdriver common by impor

 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
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
import unittest
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class Test2(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def test_2(self):
driver = self.driver
driver.get("http://www.itbox.ua/")
menu_item = driver.find_element_by_xpath("/html/body/div[6]/div[1]/div[1]/div[2]/ul/li[7]")
ActionChains(driver).move_to_element(menu_item).perform()
driver.find_element_by_id("o27427").click()
#driver.implicitly_wait(30000)
driver.find_element_by_xpath("/html/body/div[6]/div[2]/div[@id='filteres_line']/div/div/div[2]/a").click()
driver.find_element_by_id("buy149821").click()
driver.find_element_by_xpath("/html/body/div[4]/div[2]/div/div[2]/div/span[1]/span").click()
driver.find_element_by_xpath("/html/body/div[5]/div[2]/div[2]/form/p/input[4]").click()
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//tbody[@id='cart_table']/tr/td[2]"))
)
driver.close()
if __name__ == "__main__":
unittest.main()