forked from china-testing/python-api-tesing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtooltip_test.py
More file actions
executable file
·46 lines (36 loc) · 1.48 KB
/
tooltip_test.py
File metadata and controls
executable file
·46 lines (36 loc) · 1.48 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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# 讨论钉钉免费群21745728 qq群144081101 567351477
# CreateDate: 2018-10-17
import unittest
import time
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
from selenium.webdriver.common.action_chains import ActionChains
class ToolTipTest (unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.driver.get("http://jqueryui.com/tooltip/")
self.driver.implicitly_wait(30)
self.driver.maximize_window()
def test_tool_tip(self):
driver = self.driver
frame_elm = driver.find_element_by_class_name('demo-frame')
driver.switch_to.frame(frame_elm)
time.sleep(3)
age_field = driver.find_element_by_id('age')
ActionChains(self.driver).move_to_element(age_field).perform()
time.sleep(3)
tool_tip_elm = WebDriverWait(self.driver, 10).until(
expected_conditions.visibility_of_element_located((
By.CLASS_NAME, 'ui-tooltip-content')))
# verify tooltip message
self.assertEqual('We ask for your age only for statistical purposes.',
tool_tip_elm.text)
time.sleep(3)
def tearDown(self):
self.driver.close()
if __name__ == '__main__':
unittest.main(verbosity=2)