Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 094d446

Browse files
authored
Added app mode support for micorsoft edge, IE mode for internet explorer and increase timeout for test run. (#744)
* Added msie mode for internet explorer and fixed app mode for edge browser. Added MSIE mode to support device which does not have edge installed by default ( win <10). Added support in edge to support edge mode or new window mode if app mode is not requested.
1 parent 27ddbbe commit 094d446

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Setup test execution environment.
3232
run: pip3 install -r requirements-meta.txt
3333
- name: Run tox tests
34-
run: tox -- --durations=0 --timeout=30
34+
run: tox -- --durations=0 --timeout=240
3535

3636
typecheck:
3737
strategy:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Additional options can be passed to `eel.start()` as keyword arguments.
100100
Some of the options include the mode the app is in (e.g. 'chrome'), the port the app runs on, the host name of the app, and adding additional command line flags.
101101

102102
As of Eel v0.12.0, the following options are available to `start()`:
103-
- **mode**, a string specifying what browser to use (e.g. `'chrome'`, `'electron'`, `'edge'`, `'custom'`). Can also be `None` or `False` to not open a window. *Default: `'chrome'`*
103+
- **mode**, a string specifying what browser to use (e.g. `'chrome'`, `'electron'`, `'edge'`,`'msie'`, `'custom'`). Can also be `None` or `False` to not open a window. *Default: `'chrome'`*
104104
- **host**, a string specifying what hostname to use for the Bottle server. *Default: `'localhost'`)*
105105
- **port**, an int specifying what port to use for the Bottle server. Use `0` for port to be picked automatically. *Default: `8000`*.
106106
- **block**, a bool saying whether or not the call to `start()` should block the calling thread. *Default: `True`*

eel/browsers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
import eel.chrome as chm
88
import eel.electron as ele
99
import eel.edge as edge
10+
import eel.msIE as ie
1011
#import eel.firefox as ffx TODO
1112
#import eel.safari as saf TODO
1213

1314
_browser_paths: Dict[str, str] = {}
1415
_browser_modules: Dict[str, ModuleType] = {'chrome': chm,
1516
'electron': ele,
16-
'edge': edge}
17+
'edge': edge,
18+
'msie':ie}
1719

1820

1921
def _build_url_from_dict(page: Dict[str, str], options: OptionsDictT) -> str:

eel/edge.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99

1010

1111
def run(_path: str, options: OptionsDictT, start_urls: List[str]) -> None:
12-
cmd = 'start microsoft-edge:{}'.format(start_urls[0])
13-
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)
14-
12+
if not isinstance(options['cmdline_args'], list):
13+
raise TypeError("'cmdline_args' option must be of type List[str]")
14+
args: List[str] = options['cmdline_args']
15+
if options['app_mode']:
16+
cmd = 'start msedge --app={} '.format(start_urls[0])
17+
cmd = cmd + (" ".join(args))
18+
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)
19+
else:
20+
cmd = "start msedge --new-window "+(" ".join(args)) +" "+(start_urls[0])
21+
sps.Popen(cmd,stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)
1522

1623
def find_path() -> bool:
1724
if platform.system() == 'Windows':

eel/msIE.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import platform
2+
import subprocess as sps
3+
import sys
4+
from typing import List
5+
6+
from eel.types import OptionsDictT
7+
8+
name: str = 'MSIE'
9+
10+
11+
def run(_path: str, options: OptionsDictT, start_urls: List[str]) -> None:
12+
cmd = 'start microsoft-edge:{}'.format(start_urls[0])
13+
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)
14+
15+
16+
def find_path() -> bool:
17+
if platform.system() == 'Windows':
18+
return True
19+
20+
return False

0 commit comments

Comments
 (0)