@bornkiller
2015-03-10T11:05:51.000000Z
字数 2949
阅读 2505
javascript
(function(){
document.querySelector('#vpofficialtitlev5_wrap').style.display = 'none';
document.querySelector('#qheader').style.display = 'none';
document.querySelector('#vpofficialinfov5_wrap').style.display = 'none';
box = document.querySelectorAll('.box')
for (var i=0; i<box.length; i++) {box[i].style.display = 'none';}
document.querySelector('#qfooter').style.display = 'none';
document.querySelector('.mainCol').style.display = 'none';
document.querySelector('#sideTool').style.display = 'none';
document.body.style.backgroundColor='black';
document.querySelector('.screen').style.marginTop='80px';
})()
superagent 在worker中使用,调整line 205:
var root = 'undefined' == typeof window
? self
: window;
if (!obj.constructor || !(Object == obj.constructor)) return '';
if (!obj.constructor || !Object == obj.constructor) return '';
依赖文件路径
jasonborndeMacBook-Air:selenium jasonborn$ ls
chromedriver_2.12.zip
selenium-server-standalone-2.44.0.jar
jasonborndeMacBook-Air:selenium jasonborn$ pwd
/usr/local/lib/node_modules/protractor/selenium
配置文件
// An example configuration file
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to the configuration file location passed
// to protractor (in this example conf.js).
// They may include glob patterns.
specs: ['index.spec.js'],
directConnect: true,
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true // Use colors in the command line report.
}
};
测试文件
// spec.js
describe('snowykiss homepage', function() {
it('should have a title', function() {
browser.get('http://127.0.0.1:1336/');
expect(browser.getTitle()).toEqual('web worker');
});
});
待测试页面必须为完整的angular application
,否则会报错。
download = document.createElement("A");
download.href = url;
document.body.appendChild(download);
download.click();
setTimeout(function() { download.parentNode.removeChild(download); }, 50);
var debug = require('debug')('master');
var deviant = require('debug')('master');
// 调整信息输出方法
deviant.log = console.error.bind(console);
deviant('place error default standard output');
// 用以计时亦可
debug('the %s has never change', 'world');
setTimeout(function() {
debug('the %s has never change', 'human');
}, 200);
# 不清楚具体原理,必须置于最前
DEBUG=* node slavery.js
OSX下使用karma调用headless浏览器时,需要声明
declare -x PHANTOM_JS='/usr/local/bin/phantomjs';
getJasmineRequireObj().toBeCloseTo = function() {
function toBeCloseTo() {
return {
compare: function(actual, expected, precision) {
if (precision !== 0) {
precision = precision || 2;
}
return {
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
};
}
};
}
return toBeCloseTo;
};
// version-1
element.val('colorful');
element.trigger($sniffer.hasEvent('input') ? 'input' : 'change');
// version-2
ngModelController = el.find('input').controller('ngModel');
ngModelController.$setViewValue('test');