Skip to content

Instantly share code, notes, and snippets.

@neekey
Created November 17, 2012 16:56
Show Gist options
  • Save neekey/4097639 to your computer and use it in GitHub Desktop.
Save neekey/4097639 to your computer and use it in GitHub Desktop.
webdriverNode 多个实例操纵同个session
var assert = require( 'assert' );
var client = require( '../../lib/core/webdriverNode').remote({
desiredCapabilities: {
browserName:"chrome"
}
});
describe( 'Protocol methods', function(){
describe( '#execute()', function(){
it( 'Execute a script.', function( done ){
client.init();
client.protocol.url( 'http://www.baidu.com', function(){
var newC = require( '../../lib/core/webdriverNode').remote({
desiredCapabilities: {
browserName:"chrome"
}
});
newC._data.sessionId = client._data.sessionId;
setTimeout(function(){
newC.protocol.executeAsync('alert( "hahah");', function(){
newC.end();
});
}, 3000);
} );
client.protocol.executeAsync('var cb = arguments[0]; document.body.style.background="red";cb("hello");', function( ret ){
//client.end();
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment