# -*- coding:utf-8 -*-
"""
在元素上执行双击操作
"""
from selenium import webdriver
from selenium.webdriver import ActionChains
import unittest
class Actions_Element_Click(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.get(r'F:\电子书\selenium\Selenium Testing Tools Cookbook(中文)\demo\DoubleClickDemo.html')
def test_element_double_click(self):
driver = self.driver
message = driver.find_element_by_id('message')
# message.value_of_css_property('font-size'): 获取css的属性值
self.assertEqual('14px', message.value_of_css_property('font-size'))
action_chains = ActionChains(driver)
action_chains.double_click(message).perform() #鼠标双击动作
self.assertEqual('20px', message.value_of_css_property('font-size'))
def tearDown(self):
self.driver.quit()