Advertisement
Guest User

Untitled

a guest
Nov 28th, 2017
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.support.ui import WebDriverWait
  4. from selenium.webdriver.support import expected_conditions as EC
  5. import unittest
  6.  
  7.  
  8. class TestGmail(unittest.TestCase):
  9.     @classmethod
  10.     def setUpClass(cls):
  11.         cls.url = "https://mail.google.com/mail/u/1/#inbox/"
  12.         cls.driver = webdriver.Chrome()
  13.         cls.driver.implicitly_wait(10)
  14.         cls.username = "222icecream222@gmail.com"
  15.         cls.username_xpath = "//input[@type='email']"
  16.         cls.next_button = "identifierNext"
  17.         cls.password_xpath = "//input[@name='password']"
  18.         cls.password = "222111222"
  19.         cls.next_button2 = "passwordNext"
  20.  
  21.     @classmethod
  22.     def tearDownClass(cls):
  23.         #cls.driver.quit()
  24.         pass
  25.  
  26.     def login(self, username, password):
  27.         self.driver.find_element_by_xpath("//input[@type='email']").send_keys(username)
  28.         self.driver.find_element_by_id("identifierNext").click()
  29.         self.driver.find_element_by_xpath("//input[@name='password']").send_keys(password)
  30.         self.driver.find_element_by_id("passwordNext").click()
  31.         self.driver.find_element_by_xpath("//div[@class='T-I J-J5-Ji T-I-KE L3']").click()
  32.  
  33.     def test_work_gmail(self):
  34.         self.driver.get(self.url)
  35.         self.login(self.username, self.password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement