Open qadeerqureshi opened 7 years ago
Hi @qadeerqureshi ,
I've tried to reproduce your error with the below script
// conf
// An example configuration file.
exports.config = {
// Capabilities to be passed to the webdriver instance.
seleniumAddress: 'http://localhost:4444/wd/hub/',
capabilities: {
'browserName': 'firefox'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 120000
},
allScriptsTimeout: 120000,
};
// spec
describe('switch windows in firefox', function() {
it('switch between windows', function() {
browser.ignoreSynchronization=true;
browser.get('https://nl.pinterest.com/');
// open new popup
$('.FacebookConnectButton').click();
// Need to switch to htem
browser.getAllWindowHandles().then(function (handles) {
// Wait is just a validation for myself to check it
browser.sleep(3000);
// Swtich to the pop-up
browser.driver.switchTo().window(handles[1]);
// close it, I don't want to join ;-)
browser.driver.close();
// switch back to the previous
browser.driver.switchTo().window(handles[0]);
// Wait is just a validation for myself to check it
browser.sleep(3000);
});
// Close the connection error modal
$('.UnauthBanner__continueButton').click();
// Wait is just a validation for myself to check it
browser.sleep(3000);
// Open the pop-up again
$('.FacebookConnectButton').click();
// Wait is just a validation for myself to check it
browser.sleep(3000);
});
});
And this works
npm run test.example
> protractor@5.1.2 test.example /Users/wswebcreation/protractor
> node ./bin/protractor example/conf.js
(node:76745) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[10:29:47] I/launcher - Running 1 instances of WebDriver
[10:29:47] I/hosted - Using the selenium server at http://localhost:4444/wd/hub/
Started
.
1 spec, 0 failures
Finished in 15.974 seconds
[10:30:06] I/launcher - 0 instance(s) of WebDriver still running
I'm running on:
Can you verify the above script and check if it works on your machine (mind the geckodriver version)
Hi wswebcreation, i really appreciate your effort, but for reproducing this bug you have to let it close automatically by using credentials. Cause it worked for me as well in case of browser.close
Thanks!
But did you also put the focus back on the previous window after submitting your credentials?
yes i did but it never execute next statement.
Ok, will dive into it the coming days
Ok,
I now see what you mean. When you do a normal page load the firefox driver will log these events
13:47:45.938 INFO - Executing: [get: https://nl.pinterest.com/])
1500032865943 Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
1500032866202 Marionette DEBUG Received DOM event "pagehide" for "about:blank"
1500032866202 Marionette DEBUG Received DOM event "unload" for "about:blank"
1500032868005 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://nl.pinterest.com/"
1500032868095 Marionette DEBUG Received DOM event "pageshow" for "https://nl.pinterest.com/"
1500032868243 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://staticxx.facebook.com/connect/xd_arbiter/r/XBwzv5Yrm_1.js?version=42#channel=f27491a8296ffc&origin=https%3A%2F%2Fnl.pinterest.com"
1500032868247 Marionette DEBUG Received DOM event "pageshow" for "https://staticxx.facebook.com/connect/xd_arbiter/r/XBwzv5Yrm_1.js?version=42#channel=f27491a8296ffc&origin=https%3A%2F%2Fnl.pinterest.com"
1500032868399 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://apis.google.com/"
1500032868501 Marionette DEBUG Received DOM event "pageshow" for "https://apis.google.com/"
1500032868538 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Fnl.pinterest.com&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.nl.dp99l6UQZ5w.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO9ji5DzrKlKxMz97VBUYmhDx7Rzw#rpctoken=471762141&forcesecure=1"
1500032868562 Marionette DEBUG Received DOM event "pageshow" for "https://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Fnl.pinterest.com&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.nl.dp99l6UQZ5w.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO9ji5DzrKlKxMz97VBUYmhDx7Rzw#rpctoken=471762141&forcesecure=1"
1500032868587 Marionette DEBUG Received DOM event "pageshow" for "https://nl.pinterest.com/"
1500032868593 Marionette DEBUG Received DOM event "pageshow" for "https://nl.pinterest.com/"
13:47:48.599 INFO - Done: [get: https://nl.pinterest.com/]
When you successfully logon you are redirected. You then get this logging
13:47:52.372 INFO - Executing: [click: 3 [[FirefoxDriver: firefox on ANY (32b66f9c-60a7-dc40-ad7e-81dbd30743a0)] -> css selector: #u_0_2]])
1500032872413 Marionette DEBUG Received DOM event "beforeunload" for "https://www.facebook.com/login.php?skip_api_login=1&api_key=274266067164&signed_next=1&next=https%3A%2F%2Fwww.facebook.com%2Fv2.3%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fnl.pinterest.com%252Fconnect%252Ffacebook%252F%26display%3Dpopup%26scope%3Demail%252Cuser_likes%252Cuser_about_me%252Cuser_birthday%252Cuser_friends%26client_id%3D274266067164%26ret%3Dlogin%26logger_id%3Dcf789f00-4277-c24b-91c4-96ebb76eac9e&cancel_url=https%3A%2F%2Fnl.pinterest.com%2Fconnect%2Ffacebook%2F%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%23_%3D_&display=popup&locale=nl_NL&logger_id=cf789f00-4277-c24b-91c4-96ebb76eac9e"
1500032873550 Marionette DEBUG Received DOM event "pagehide" for "https://www.facebook.com/login.php?skip_api_login=1&api_key=274266067164&signed_next=1&next=https%3A%2F%2Fwww.facebook.com%2Fv2.3%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fnl.pinterest.com%252Fconnect%252Ffacebook%252F%26display%3Dpopup%26scope%3Demail%252Cuser_likes%252Cuser_about_me%252Cuser_birthday%252Cuser_friends%26client_id%3D274266067164%26ret%3Dlogin%26logger_id%3Dcf789f00-4277-c24b-91c4-96ebb76eac9e&cancel_url=https%3A%2F%2Fnl.pinterest.com%2Fconnect%2Ffacebook%2F%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%23_%3D_&display=popup&locale=nl_NL&logger_id=cf789f00-4277-c24b-91c4-96ebb76eac9e"
1500032873551 Marionette DEBUG Received DOM event "unload" for "https://www.facebook.com/login.php?skip_api_login=1&api_key=274266067164&signed_next=1&next=https%3A%2F%2Fwww.facebook.com%2Fv2.3%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fnl.pinterest.com%252Fconnect%252Ffacebook%252F%26display%3Dpopup%26scope%3Demail%252Cuser_likes%252Cuser_about_me%252Cuser_birthday%252Cuser_friends%26client_id%3D274266067164%26ret%3Dlogin%26logger_id%3Dcf789f00-4277-c24b-91c4-96ebb76eac9e&cancel_url=https%3A%2F%2Fnl.pinterest.com%2Fconnect%2Ffacebook%2F%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%23_%3D_&display=popup&locale=nl_NL&logger_id=cf789f00-4277-c24b-91c4-96ebb76eac9e"
1500032873648 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://nl.pinterest.com/connect/facebook/?code=AQCRDW10JWc3KfCdkiTQ63Ax8l__hXVm7QMKDYxIlUCfGfrbZWAdVAAOfmR_sz0CHkr_pBVmqH1EUcF1bkVLVR-ftx7M1sJFd6caT_W2Bh1Q_fERXFRMBOitilhf307KQVPUmI90trM05XqE_Ho4mse077f9BiyZKw8JOlVA4iDcLZfhZq35Nrw2fq1ni5V5FPyIvhJ5Vdsc8dCE5ph8kMLdSuPfTS12EdtFngPOBbB00-xCQWpXa-kS8Yoeg89IDPBqF26VmynNuXDOTug43WeK4BSFPZ-zWo-EIfG5ghmjawlP7SFhUPL-WGryd1uHqy6iebD1_kFBa234DLuPLFUz#_=_"
1500032873649 Marionette DEBUG Received DOM event "pageshow" for "https://nl.pinterest.com/connect/facebook/?code=AQCRDW10JWc3KfCdkiTQ63Ax8l__hXVm7QMKDYxIlUCfGfrbZWAdVAAOfmR_sz0CHkr_pBVmqH1EUcF1bkVLVR-ftx7M1sJFd6caT_W2Bh1Q_fERXFRMBOitilhf307KQVPUmI90trM05XqE_Ho4mse077f9BiyZKw8JOlVA4iDcLZfhZq35Nrw2fq1ni5V5FPyIvhJ5Vdsc8dCE5ph8kMLdSuPfTS12EdtFngPOBbB00-xCQWpXa-kS8Yoeg89IDPBqF26VmynNuXDOTug43WeK4BSFPZ-zWo-EIfG5ghmjawlP7SFhUPL-WGryd1uHqy6iebD1_kFBa234DLuPLFUz#_=_"
You logged on successful, but the firefox driver looks like it is hanging and not spawning any logging anymore. It then gives a timeout due to the Jasmine timeout
@qadeerqureshi , did you also got this working on other browsers?
Thanks for investigating! It might be related to https://github.com/mozilla/geckodriver/issues/818, but isn't the exact same issue. Do you have this problem on other browsers? Can you try running against firefox nightly?
If you guys could boil this down to a simple test that demonstrates the issue and put it on github, that'd be really helpful. We could show that to the geckodriver and selenium folks and see what they think.
v6.10.2
Version 5.1.2
Firefox 54.0.1
Windows 10
Steps to reproduce the bug
54.0.1
browser.switchTo().window(handles[state])
browser tab for getting focus.Additional Information: In this firefox version 54.0.1 bugs are fixed which are
Thanks!