Skip to content

Commit

Permalink
Merge pull request #607 from rhysd/active-element-w3c
Browse files Browse the repository at this point in the history
Support W3C get active element command
  • Loading branch information
admc authored Nov 7, 2019
2 parents cf53544 + 7bfdf92 commit b150ce2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1987,8 +1987,9 @@ commands.dismissAlert = function() {
*/
commands.active = function() {
var cb = findCallback(arguments);
var method = this.w3c ? 'GET' : 'POST';
this._jsonWireCall({
method: 'POST'
method: method
, relPath: '/element/active'
, cb: callbackWithData(cb, this)
});
Expand Down
2 changes: 2 additions & 0 deletions lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ Webdriver.prototype._init = function() {
try{
jsonData = JSON.parse(data);
_this.sessionID = jsonData.value ? jsonData.value.sessionId : false;
_this.w3c = false;
resData = jsonData.value;

if(!_this.sessionID && jsonData.status === 0 ){
_this.sessionID = jsonData.sessionId;
_this.w3c = true;
}
} catch(ignore){}
if(!_this.sessionID){
Expand Down

0 comments on commit b150ce2

Please sign in to comment.