-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcase.py
More file actions
61 lines (60 loc) · 1.38 KB
/
testcase.py
File metadata and controls
61 lines (60 loc) · 1.38 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from selenium import webdriver
import time
def invoke_browser(func):
def inner(url):
driver=webdriver.Chrome("C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python35\\Scripts\\chromedriver.exe")
driver.get(url)
func(driver)
driver.close()
print("test1 is closed")
return inner
@invoke_browser
def test1(driver):
print('test1 is executed')
time.sleep(3)
x_username = driver.find_element_by_id("username")
a="admin"
username=lambda element,a:element.send_keys(a)
username(x_username,a)
time.sleep(3)
driver.find_element_by_name("pwd").send_keys("manager")
time.sleep(3)
driver.find_element_by_id("loginButton").click()
#
#
# @invoke_browser
# def test2(driver):
# print('test2 is executed')
#
#
# @invoke_browser
# def test3(driver):
# print('test3 is executed')
#
#
# @invoke_browser
# def test4(driver):
# print('test4 is executed')
#
#
# @invoke_browser
# def test5(driver):
# print('test5 is executed')
#
#
# @invoke_browser
# def test6(driver):
# print('test6 is executed')
#
#
# @invoke_browser
# def test7(driver):
# print('test7 is executed')
#
test1("http://localhost/login.do")
# test2("https://www.facebook.com/")
# test3("https://www.google.com/")
# test4("https://www.amazon.in/")
# test5("https://www.flipkart.in/")
# test6("https://www.gmail.com/")
# test7("https://www.bigbasket.com/")