-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsignup.py
More file actions
47 lines (42 loc) · 1.5 KB
/
Copy pathsignup.py
File metadata and controls
47 lines (42 loc) · 1.5 KB
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
41
42
43
44
45
46
47
import pytest #pip install pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time
import unittest
from parameterized import parameterized #pip install parameterized
from helper_functions import readData
class Signup(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.driver.implicitly_wait(10)
self.vars = {}
self.driver.get("https://shopee.vn/buyer/signup")
self.driver.set_window_size(1323, 1025)
def tearDown(self):
self.driver.quit()
def close_add(self):
try:
self.driver.find_element(By.CSS_SELECTOR, ".home-popup__close-area").click()
except:
pass
else:
self.driver.find_element(By.CSS_SELECTOR, ".home-popup__close-area").click()
finally:
pass
@parameterized.expand(readData("signup"))
def test_tC001001(self, no, phonenumber):
signupField = self.driver.find_element(By.NAME,"phone")
signupField.click()
signupField.send_keys(phonenumber)
signupField.send_keys(Keys.RETURN)
self.driver.implicitly_wait(10)
self.close_add()
if __name__ == '__main__':
unittest.main()