7. 获取对象的熟悉以及CSS熟悉
2014-07-23 10:23
267 查看
HTML: <html> <head> <metahttp-equiv="content-type"content="text/html;charset=utf-8"/> <title>attribute</title> <scripttype="text/javascript"async=""src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <linkhref="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"rel="stylesheet"/> <scripttype="text/javascript"> $(document).ready(function(){ $('#tooltip').tooltip({"placement":"right"}); }); </script> </head> <body> <h3>attribute</h3> <divclass="row-fluid"> <divclass="span6"> <aid="tooltip"href="#"data-toggle="tooltip"title="watir-webdriverbetterthanselenium-webdriver">hovertoseetooltip</a> </div> </div> </body> <scriptsrc="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> </html> ==================================================================================================================================================== PythonCode
#-*-coding:utf-8-*- fromseleniumimportwebdriver fromtimeimportsleep importos if'HTTP_PROXY'inos.environ:delos.environ['HTTP_PROXY'] dr=webdriver.Chrome() file_path='file:///'+os.path.abspath('css.html') dr.get(file_path) link=dr.find_element_by_id('tooltip') printlink.value_of_css_property('color') printdr.find_element_by_tag_name('h3').value_of_css_property('font') #获得tooltip的内容 printlink.get_attribute('title') #获取该链接的text printlink.text
dr.quit()
相关文章推荐
- 获取对象CSS属性
- JS获取当前对象大小以及屏幕分辨率等
- 黑马程序员——list()返回该目录下文件,文件夹,listFiles()返回文件文,件夹对象,递归调用获取所有文件,文件夹,以及文件名过滤
- Jquery获取table中的行和列以及列中对象方法
- 如何通过Spring获取到Hibernate的Configuration对象以及Table,Column对象
- 从对象的角度理解委托以及委托链的返回值获取
- javascript获取未知对象属性以及属性值
- 获取元素CSS值之getComputedStyle方法熟悉
- QTP11使用DOM XPath以及CSS识别元素对象
- coolite 客户端对象的获取以及客户端对话框的使用
- [转载]JS获取当前对象大小以及屏幕分辨率等
- servlet构造response,以及获取RequestDispatcher对象
- JS获取当前对象大小以及屏幕分辨率等
- JS中的log对象获取以及debug写法
- 如何创建CSS的对象?获取合适的粒度!
- 加载进来的dae,获取到的内部对象的三维坐标,以及旋转原则同3ds max内部的坐标和旋转。
- Jquery获取table中的行和列以及列中对象方法
- C#泛型、反射-根据对象名获取该类型以及其属性
- BOM__Document对象简介-三种获取节点方式,通过节点层次关系获取节点,以及对象中的属性操作
- 获取视图的宽度和高度,以及设置对象的随机位置