search engine research_百度空间
 
文章列表
 
2012年05月29日 星期二 17:19

#程序名: test_fabric.py

 

from fabric.api import *

from fabric.api import run

env.host_string = '192.168.01.100'

#env.password = ''

 

#if set, it will continue to run when err 

env.warn_only=True

def main():

    sudo('crontab -l; echo "ok" ', 'jakisou')   

 

if __name__ == '__main__':

 
2012年05月24日 星期四 14:36

import fcntl

pid_file ='program.pid'
fp = open(pid_file,'w')
try:
    fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
exceptIOError:
    # another instance is running
    sys.exit(0)

 
2012年05月24日 星期四 12:04

#coding:utf-8

 

"""

Internet Explorer:

The easiest and recommended way is to manually set the proxy on the machine that will be running the test. If that is not possible or you want your test to run with a different configuration or proxy, then you can use the following technique that uses a Capababilities object. This temporarily changes the system’s proxy settings and changes them back to the orig

 
2012年05月24日 星期四 11:31

处理弹出窗口

在Selenium,弹出窗口是比较棘手的一个问题,下面谈谈利用Python怎么处理弹出窗口。

最简单的方法:创建弹出窗口,然后使用get_all_window_names和select_window方法

 

1. get_all_window_names(self):  Returns the names of all windows that the browser knows about.

2. select_window(self,windowID): Selects a popup window using a window locator; once a popup window has been selected, all commands go to that

 
2012年05月24日 星期四 11:31

checkbox:

使用check和is_checked方法

 

    def test_click_checkbox_with_ischecked(self):

        sel = self.selenium

        sel.open(self.TEST_PAGE_URL)

        sel.wait_for_page_to_load(self.MAX_WAIT_IN_MS)

        sel.check("id=checkBoxInput")

        self.assertTrue(sel.

 
2012年05月24日 星期四 11:26

1. 检查标题

 

def test_navigate_page_without_click_link(self):

        sel = self.selenium

        sel.open(self.BASE_URL)

        sel.open(self.TEST_PAGE_URL)

        self.assertEquals(self.TEST_PAGE_TITLE, sel.get_title())

        

def test_navigate_page_click_link(self):

 

 
2012年05月24日 星期四 11:23

为了全面测试一个Web系统,我们需要与系统UI相交互并做出相应的断言。

最常用的交互是通过selenium.py中以下方法来实现的:

open(url): Opens an URL in the test frame. This accepts both relative and absolute URLs. 

click(locator): Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call    waitForPageToLoad.

type(locator, value):  Sets

 
2012年05月24日 星期四 11:23

Selenium是thoughtworks公司的一个集成测试的强大工具,关于它的好处网络随处可以搜到,我就不一一介绍,在之前见到一个系列是Selenium Remote Control For Java,在这里模仿一下,主要以Python来实现。一是我比较喜欢用Python,二是刚好可以练手,熟悉熟悉Python开发Selenium RC脚本。

What is Selenium?

Selenium is a testing tool for web applications that uses JavaScript and Iframes to run tests directly in a browser. There are several test tools based

 
2012年05月24日 星期四 10:22

支持浏览器:

firefox, chrome, ie, opera

开发语言:

python

其它:

1. 代理支持

2. 表单提交

3. 模拟点击

范例: chrome

 #coding:utf-8

# 官网地址: http://code.google.com/p/chromedriver/wiki/GettingStarted

# 下载 chromedriver_linux32_20.0.1133.0.zip 

# 解压得到 chromedriver

#示范代码

from selenium import webdriver

driver = webdriver.Chrome('/pat

 
2012年05月23日 星期三 11:08

1、系统的平均负载的概念

  有时候我们会觉得系统响应很慢,但是又找不到原因,这时就要查看平均负载了,看它是否有大量的进程在排队等待。特定时间间隔内运行队列中的平均进程数可以反映系统的繁忙程度,所以我们通常会在自己的网站或系统变慢时第一时间查系统的负载,即CPU的平均负载。

  2、查看平均负载

  究竟应该如何查看平均负载呢?最简单的命令是uptime

 
     
 
 
个人档案
 
jakisou
男, 
北京 海淀区 
 
   
 
最新评论
 
     
 
好友最新文章
 
     
 
最近访客
 
 

lhrkkk

melina880810

284705452

zqq1016

wys80a

hxnhlx

ccpass888

chzhcpu
     
 
背景音乐
 
     
 
订阅我的空间
 
已有人次访问本空间
 
订阅RSS  什么是RSS?

您也想拥有这样的空间?请点此申请。
     

帮助中心  |  空间客服  |  投诉中心  |  空间协议
©2012 Baidu