This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
exec = require('child_process').exec, | |
isWin = process.platform.indexOf('win') === 0; | |
function nohup(cmd, options, callback){ | |
if(typeof options === 'function'){ | |
callback = options; | |
options = null; | |
} | |
if(isWin){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//检查全部 | |
inspect.check(); | |
//检查指定的任务 | |
inspect.check("check-meta-charset"); | |
//检查多个任务 | |
inspect.check(["check-meta-charset","check-doctype"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//driver这个对象是内置的,在编写单侧代码的时候直接调用即可,它包含上面罗列的方法,上面的方法调用后, | |
//返回一个webElement的对象,webElement还可以继续调用上面的方法,获取子元素、获取属性值、each、click、submit等更多的操作 | |
//driver.find_element_by_id() | |
var input = driver.find_element_by_id("kw"); | |
should(input.get_attribute("value")).be().equal("123").error("xxxx"); | |
//driver.find_element_by_name() | |
//获取一个name | |
var input = driver.find_element_by_name("kw"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//should介词 | |
should("xxx").be() | |
should("xxx").not() | |
should("xxx").and() | |
should("xxx").have() | |
should(xxx).has() | |
//should(xxx).have().property | |
should({name : 1}).have().property("name").fail(function(){ | |
monitor.sendError("have not property"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DeviceOrientation = (function(win){ | |
var targetElement = null, | |
isRotate = false; | |
function deviceOrientationHandler(eventData){ | |
var lr = -Math.round(eventData.gamma), | |
maxRotateY = 15; | |
// 去燥 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// expires方法的参数是以秒为单位的,其他的方法跟localStorage的相同 | |
// 方法有:getItem/setItem/removeItem/clear/expires | |
// 30秒后过期 | |
storage.setItem("test","hello world").expires(30); | |
storage.setItem("test","hello world"); | |
storage.expires(30); | |
// clear全部由storage创建的localStorage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//来源:http://www.cnblogs.com/Random/archive/2013/03/29/2989789.html | |
function fireKeyEvent(el, evtType, keyCode){ | |
var evtObj; | |
if(document.createEvent){ | |
if( window.KeyEvent ) { | |
evtObj = document.createEvent('KeyEvents'); | |
evtObj.initKeyEvent( evtType, true, true, window, false, false, false, false, keyCode, 0 ); | |
} else { | |
evtObj = document.createEvent('UIEvents'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 初始化autocomplete dialog的各项功能 | |
// items参数就是complete框默认可见多少项 | |
// editor参数是ACE的实例化对象 | |
var autocomplete = new AceAutoComplete(editor,{ | |
items : 10 | |
}); |
NewerOlder