上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 1 import org.openqa.selenium.WebDriver; 2 import org.openqa.selenium.chrome.ChromeDriver; 3 4 /* 5 * 返回当前页面 url 和 title 6 */ 7 public class GetUrl... 阅读全文
posted @ 2014-07-09 15:33 Roger| 阅读(442) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * 打开 url 的两种方法 3 */ 4 public class OpenUrl { 5 6 public static void main(String[] args) { 7 String url = "http://www.baidu.com"... 阅读全文
posted @ 2014-07-09 15:32 Roger| 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * 打开浏览器 3 */ 4 public class OpenBrowsers { 5 6 public static void main(String[] args) { 7 // 打开默认路径的 firefox 8 //We... 阅读全文
posted @ 2014-07-09 15:31 Roger| 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 开发环境1. jdk1.72.Eclipse3. selenium(selenium-java-2.42.2.zip)将下载下来的selenium-java-2.42.2.zip 解压, 解压后文件目录:建立Java Project 项目1. 将上面加压出来的文件复制到新建的项目目录下:2.添加bu... 阅读全文
posted @ 2014-07-08 15:37 Roger| 阅读(361) 评论(0) 推荐(0) 编辑
摘要: http://tungwaiyip.info/software/HTMLTestRunner.html下载,将下载后的文件放在python的Lib目录下 1 # -*- coding:utf-8 -*- 2 3 import HTMLTestRunner 4 import unittest 5 f... 阅读全文
posted @ 2013-09-17 22:15 Roger| 阅读(1555) 评论(0) 推荐(0) 编辑
摘要: Python内置了一些非常有趣但非常有用的函数,充分体现了Python的语言魅力!filter(function, sequence):对sequence中的item依次执行function(item),将执行结果为True的item组成一个List/String/Tuple(取决于sequence的类型)返回: >>> def f(x): return x % 2 != 0 and x % 3 != 0>>> filter(f, range(2, 25))[5, 7, 11, 13, 17, 19, 23]>>> def f(x): re 阅读全文
posted @ 2013-09-04 23:29 Roger| 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1 from abc import ABCMeta, abstractmethod 2 3 class Super(object): 4 __metaclass__ = ABCMeta 5 6 def delegate(self): 7 self.action() 8 9 @abstractmethod10 def action(self):11 pass12 13 @abstractmethod14 def method(self):15 pass使用metaclass与@abstract... 阅读全文
posted @ 2013-08-04 02:11 Roger| 阅读(188) 评论(0) 推荐(0) 编辑
摘要: __str__是被print函数调用的,一般都是return一个什么东西。这个东西应该是以字符串的形式表现的。如果不是要用str()函数转换。当你打印一个类的时候,那么print首先调用的就是类里面的定义的__str__ 1 class Person(object): 2 def __init__(self, name, job = None, pay = 0): 3 self.name = name 4 self.job = job 5 self.pay = pay 6 7 def lastName(self): 8 ... 阅读全文
posted @ 2013-07-31 23:09 Roger| 阅读(467) 评论(0) 推荐(0) 编辑
摘要: 1 # coding:utf-8 2 """ 3 页面 table处理 4 """ 5 6 from selenium import webdriver 7 from selenium.webdriver.common.by import By 8 from selenium.common.exceptions import NoSuchElementException 9 10 class WebTable(object):11 12 def __init__(self, webElement):13 self.webTable = 阅读全文
posted @ 2013-07-27 15:52 Roger| 阅读(1174) 评论(0) 推荐(1) 编辑
摘要: 1 # -*- coding:utf-8 -*- 2 3 """ 4 python 实现对象模型 5 创建 bmicalcpage 类 6 """ 7 8 class bmicalcpage(object): 9 def __init__(self, driver):10 self._driver = driver11 self._url = r'F:\电子书\selenium\Selenium Testing Tools Cookbook(中文)\demo\BMICalculator.html'12 self._ti 阅读全文
posted @ 2013-07-18 23:42 Roger| 阅读(516) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页