Optimize driver quit method
This commit is contained in:
parent
dcc743a3c4
commit
b506ac1554
|
@ -38,7 +38,7 @@ end;
|
|||
AppId={{225A7526-BAB4-4DBE-B5F6-9CE1BEACCB36}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppVerName={#MyAppName} version {#MyAppVersion}
|
||||
AppVerName={#MyAppName} {#MyAppVersion}
|
||||
VersionInfoProductName={#MyAppName}
|
||||
VersionInfoProductTextVersion={#MyAppVersion}
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
|
@ -53,6 +53,8 @@ Compression=lzma
|
|||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
CloseApplications=yes
|
||||
%DISABLEX64%ArchitecturesAllowed=x64compatible
|
||||
%DISABLEX64%ArchitecturesInstallIn64BitMode=x64compatible
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "cmd.exe"; Parameters: "/C taskkill /IM {#MyAppExec}.exe /F"; Flags: runhidden
|
||||
|
|
97
Galactic.py
97
Galactic.py
|
@ -769,6 +769,24 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
|
|||
"""
|
||||
Exit the browser.
|
||||
"""
|
||||
try:
|
||||
tab_handles = list(self.window_handles)
|
||||
tab_current = self.current_window_handle
|
||||
tab_current in tab_handles and tab_handles.remove(tab_current)
|
||||
tab_handles.append(tab_current)
|
||||
for tab in tab_handles:
|
||||
try:
|
||||
self.switch_to.window(tab)
|
||||
for _ in range(5):
|
||||
try:
|
||||
self.current_alert.dismiss()
|
||||
except Exception:
|
||||
break
|
||||
self.close()
|
||||
except NoSuchWindowException:
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
super().quit()
|
||||
except Exception:
|
||||
|
@ -1227,6 +1245,34 @@ class BrowserPluginMultTextTest(BrowserPluginParent):
|
|||
param.message(param.requirements)
|
||||
|
||||
|
||||
class BrowserPluginLoggingTest(BrowserPluginParent):
|
||||
name = '在线日志输出测试'
|
||||
requirements = [
|
||||
{
|
||||
'type': 'text-mult',
|
||||
'html': '输入内容'
|
||||
}
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def running(param):
|
||||
param.logging(param.requirements[0])
|
||||
|
||||
|
||||
class BrowserPluginMessageTest(BrowserPluginParent):
|
||||
name = '在线消息弹窗测试'
|
||||
requirements = [
|
||||
{
|
||||
'type': 'text-mult',
|
||||
'html': '输入内容'
|
||||
}
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def running(param):
|
||||
param.message(param.requirements[0])
|
||||
|
||||
|
||||
class BrowserPluginFileCommandDebug(BrowserPluginParent):
|
||||
name = '上传脚本进行调试'
|
||||
requirements = [
|
||||
|
@ -1257,34 +1303,6 @@ class BrowserPluginTextCommandDebug(BrowserPluginParent):
|
|||
code and exec(code)
|
||||
|
||||
|
||||
class BrowserPluginLoggingTest(BrowserPluginParent):
|
||||
name = '在线日志输出测试'
|
||||
requirements = [
|
||||
{
|
||||
'type': 'text-mult',
|
||||
'html': '输入内容'
|
||||
}
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def running(param):
|
||||
param.logging(param.requirements[0])
|
||||
|
||||
|
||||
class BrowserPluginMessageTest(BrowserPluginParent):
|
||||
name = '在线消息弹窗测试'
|
||||
requirements = [
|
||||
{
|
||||
'type': 'text-mult',
|
||||
'html': '输入内容'
|
||||
}
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def running(param):
|
||||
param.message(param.requirements[0])
|
||||
|
||||
|
||||
class BrowserManagerDataStorage(dict):
|
||||
def __init__(self, file: str):
|
||||
self._data_file = os.path.abspath(file)
|
||||
|
@ -2026,7 +2044,7 @@ class WebServer:
|
|||
manager_data_file=os.path.join(data, 'manager.json'),
|
||||
browser_data_home=os.path.join(data, 'users'),
|
||||
browser_init_home=os.path.join(root, 'initialize'),
|
||||
use_selenium_wire=0
|
||||
use_selenium_wire=1
|
||||
)
|
||||
self.browser_manager.load_plugins(default_plugins, is_external=0)
|
||||
self.browser_manager.load_plugins_from_external_module()
|
||||
|
@ -2199,10 +2217,10 @@ class MainRunner:
|
|||
BrowserPluginTextTest,
|
||||
BrowserPluginMultFileTest,
|
||||
BrowserPluginMultTextTest,
|
||||
BrowserPluginFileCommandDebug,
|
||||
BrowserPluginTextCommandDebug,
|
||||
BrowserPluginLoggingTest,
|
||||
BrowserPluginMessageTest
|
||||
BrowserPluginMessageTest,
|
||||
BrowserPluginFileCommandDebug,
|
||||
BrowserPluginTextCommandDebug
|
||||
]
|
||||
|
||||
def _copy_files_and_directories(self, src, dst):
|
||||
|
@ -2291,7 +2309,20 @@ class MainRunner:
|
|||
file=sys.stderr)
|
||||
return None
|
||||
Path(compile_file).write_text(
|
||||
Path(compile_template).read_text().replace('%APPNAME%', self.app_name).replace('%APPEXEC%', os.path.splitext(os.path.basename(__file__))[0]).replace('%APPVERSION%', self.app_version))
|
||||
Path(compile_template).read_text().replace(
|
||||
'%APPNAME%',
|
||||
self.app_name
|
||||
).replace(
|
||||
'%APPEXEC%',
|
||||
os.path.splitext(os.path.basename(__file__))[0]
|
||||
).replace(
|
||||
'%APPVERSION%',
|
||||
self.app_version
|
||||
).replace(
|
||||
'%DISABLEX64%',
|
||||
'' if platform.architecture()[0] == '64bit' else '; '
|
||||
)
|
||||
)
|
||||
subprocess.run([compiler, compile_file])
|
||||
|
||||
def _handle_interrupt(self, _signal, _frame):
|
||||
|
|
Loading…
Reference in New Issue