Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.common.exceptions import NoSuchElementException
- from selenium.common.exceptions import NoAlertPresentException
- from selenium.webdriver.support.wait import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.common.exceptions import TimeoutException
- import unittest, time, re
- class Smb_tools(unittest.TestCase):
- def setUp(self):
- self.driver = webdriver.Chrome()
- self.driver.implicitly_wait(30)
- self.verificationErrors = []
- self.accept_next_alert = True
- def test_untitled_test_case(self):
- driver = self.driver
- self.driver.implicitly_wait(30)
- driver.get("https://172.16.11.35/auth")
- driver.find_element_by_id("login").clear()
- driver.find_element_by_id("login").send_keys("admin")
- driver.find_element_by_id("password").click()
- driver.find_element_by_id("password").clear()
- driver.find_element_by_id("password").send_keys("123456")
- driver.find_element_by_xpath("//body[@id='auth']/div/div/div[2]/div[2]/div[2]/form/div[4]/button").click()
- #
- wait = WebDriverWait(driver, 10)
- driver.find_element_by_link_text(u"Настройки").click()
- element = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'Сетевые интерфейсы')))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//html//div[@class='section-column-1']//div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]")))
- element.click()
- #redact adres
- driver.find_element_by_xpath("//div[@class='accordion-item accordion-opened']//div[@class='accordion-block-panel']//div[@class='button-stack']//button[@class='button-medium-orange']").click()
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/button").click()
- driver.find_element_by_id("ip").clear()
- driver.find_element_by_id("ip").send_keys("172.16.11.181/24")
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div[2]/div[2]/div[2]/form/div[2]/button").click()
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/div/div/div/div").click()
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/button[3]").click()
- driver.find_element_by_xpath("//div[@class='checkbox']").click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//body[@id='main']/div/div/div[2]/div[2]/div[2]/div[2]/form/div[2]/button")))
- element.click()
- time.sleep(3)
- wait = WebDriverWait(driver, 10)
- element = wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="main"]/div[1]/div/div[2]/div/div[2]/div[2]/div/div[2]/button')))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//html//div[@class='section-column-1']//div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]")))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//html//div[@class='layout-column-right']//div[2]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]")))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='accordion-item accordion-opened']//div[@class='accordion-block-panel']//div[@class='button-stack']//button[@class='button-medium-orange']")))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/button")))
- element.click()
- driver.find_element_by_id("ip").clear()
- driver.find_element_by_id("ip").send_keys("172.16.11.182/24")
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div[2]/div[2]/div[2]/form/div[2]/button").click()
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/div/div/div/div").click()
- driver.find_element_by_xpath("//body[@id='main']/div/div/div[2]/div/div[2]/div[2]/div/div/button[3]").click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//body[@id='main']/div/div/div[2]/div[2]/div[2]/div[2]/form/div/div/div/div/div")))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.XPATH, "//form[@class='form']//div[@class='form-group']//button[@class='button-large-green']")))
- element.click()
- time.sleep(2)
- element = wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="main"]/div[1]/div/div[2]/div/div[2]/div[2]/div/div[2]/button')))
- element.click()
- element = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'Сетевые настройки')))
- element.click()
- driver.find_element_by_id("dns1").clear()
- driver.find_element_by_id("dns1").send_keys("172.16.11.247")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement