Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- import unittest
- class TestWork(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- cls.url = "https://www.youtube.com/"
- cls.driver = webdriver.Chrome()
- cls.driver.implicitly_wait(10)
- cls.username = "testirovsiktest@gmail.com"
- cls.login_button_xpath = "//*[@id='button']/*[text()='Войти']"
- cls.password = "testirovsiktest1234567890"
- @classmethod
- def tearDownClass(cls):
- cls.driver.quit()
- def login(self, username, password):
- sign_button = WebDriverWait(self.driver, 20).until(
- EC.element_to_be_clickable((By.XPATH, self.login_button_xpath))
- )
- sign_button.click()
- self.driver.find_element_by_xpath("//input[@type='email']").send_keys(username)
- self.driver.find_element_by_id("identifierNext").click()
- self.driver.find_element_by_xpath("//input[@name='password']").send_keys(password)
- self.driver.find_element_by_id("passwordNext").click()
- def upload_video(self, title, description, path_to_file):
- pass
- def test_work_youtube(self):
- self.driver.get(self.url)
- self.login(self.username, self.password)
- self.driver.implicitly_wait(10)
- self.driver.find_element_by_xpath("//*[@id='buttons']//*[@id='button']").click()
- self.driver.find_element_by_xpath("//input[@type='file']").send_keys("F:\\hey\\mouse.3gp")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement