This has risk to lock Firefox profile when multiple Firefox profiles running simuteniously. Please refer to "Firefox is aleady running issue"
Enhance Selenium-IDE by XPCOM API: close all Firefox windows under current profile. Add logic when Selenium quit(close=true).
Sample code:
var windowManager = Components .classes['@mozilla.org/appshell/window-mediator;1'].getService(); var windowManagerInterface = windowManager .QueryInterface( Components.interfaces.nsIWindowMediator); var enumerator = windowManagerInterface.getEnumerator( null ); var appStartup = Components .classes['@mozilla.org/toolkit/app-startup;1']. getService(Components.interfaces.nsIAppStartup); while ( enumerator.hasMoreElements() ) { var domWindow = enumerator.getNext(); if (("tryToClose" in domWindow) && !domWindow.tryToClose()) return false; domWindow.close(); }; appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit);
No comments:
Post a Comment