Created
November 17, 2012 16:56
-
-
Save neekey/4097639 to your computer and use it in GitHub Desktop.
webdriverNode 多个实例操纵同个session
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 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