robotframework-browser-tray 1.2.2__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotframework_browser_tray-1.4.0/PKG-INFO +121 -0
- robotframework_browser_tray-1.4.0/README.md +108 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/pyproject.toml +4 -2
- robotframework_browser_tray-1.4.0/src/BrowserTray/Repl/__init__.py +13 -0
- robotframework_browser_tray-1.4.0/src/BrowserTray/Repl/__main__.py +3 -0
- robotframework_browser_tray-1.4.0/src/BrowserTray/Repl/jsextension.js +18 -0
- robotframework_browser_tray-1.4.0/src/BrowserTray/Repl/repl.py +67 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/tray.py +30 -16
- robotframework_browser_tray-1.2.2/PKG-INFO +0 -81
- robotframework_browser_tray-1.2.2/README.md +0 -69
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/__init__.py +0 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/__main__.py +0 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/chromium.png +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: robotframework-browser-tray
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: Tray icon and REPL for trying out Browser Library keywords using Chromium or Edge
|
|
5
|
+
Author-email: Marduk Bolaños <marduk.bolanos@imbus.de>
|
|
6
|
+
Requires-Python: >=3.8.2
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: pystray>=0.19.5
|
|
9
|
+
Requires-Dist: robotframework-browser>=18.0.0
|
|
10
|
+
Requires-Dist: robotframework-debug>=4.5.0
|
|
11
|
+
Project-URL: homepage, https://github.com/mardukbp/robotframework-browser-tray
|
|
12
|
+
|
|
13
|
+
# robotframework-browser-tray
|
|
14
|
+
|
|
15
|
+
Tray icon and REPL for trying out [Browser Library](https://robotframework-browser.org/) keywords using Chromium or Edge
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
**Requirements**
|
|
19
|
+
|
|
20
|
+
- NodeJS >= 18
|
|
21
|
+
- Windows
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Use Cases
|
|
25
|
+
|
|
26
|
+
- Execute tests incrementally using e.g. [RobotCode](https://github.com/d-biehl/robotcode)
|
|
27
|
+
|
|
28
|
+
- Test selectors in an open web page interactively
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## How to use it
|
|
32
|
+
|
|
33
|
+
1. Install the package
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install robotframework-browser-tray
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Execute `browser-tray`
|
|
40
|
+
|
|
41
|
+
**Hint**: In case your environment does not allow executing browser-tray, call the Python module directly:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python -m BrowserTray
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Click on the tray icon with the Chromium logo
|
|
48
|
+
|
|
49
|
+
4. Open a Terminal and execute `ibrowser`
|
|
50
|
+
|
|
51
|
+
**Hint**: In case your environment does not allow executing ibrowser, call the Python module directly:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m BrowserTray.Repl
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### ibrowser
|
|
58
|
+
|
|
59
|
+
ibrowser allows testing selectors in an open web page interactively.
|
|
60
|
+
|
|
61
|
+
To start it execute:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
ibrowser
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
On start up it checks whether the Chromium installed by `rfbrowser init chromium` is present. It can also be used with Microsoft Edge. See the section below for instructions.
|
|
68
|
+
|
|
69
|
+
In addition to the selectors supported by Browser Library, `ibrowser` adds the selector `role` for selecting elements using their ARIA role.
|
|
70
|
+
|
|
71
|
+
The role of an element can be easily obtained from the Accessibility Tree. To open the tree follow these steps:
|
|
72
|
+
|
|
73
|
+
1. Press F12 to open the DevTools
|
|
74
|
+
2. Select the Elements tab
|
|
75
|
+
3. In the right panel click on the Accessibility tab
|
|
76
|
+
4. In the section "Accessibility Tree" check "Enable full-page accessibility tree"
|
|
77
|
+
5. Click the button "Reload DevTools"
|
|
78
|
+
6. In the left panel click on the person icon to toggle the Accessibility Tree view
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Usage in a Robot Framework Test Suite
|
|
82
|
+
|
|
83
|
+
Add these lines to the Settings section of the .robot file:
|
|
84
|
+
|
|
85
|
+
```robotframework
|
|
86
|
+
Library Browser playwright_process_port=55555
|
|
87
|
+
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
In order to use other ports execute:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Using Microsoft Edge
|
|
98
|
+
|
|
99
|
+
If Microsoft Edge is installed on your machine:
|
|
100
|
+
|
|
101
|
+
1. Create a Shortcut to msedge.exe with the target:
|
|
102
|
+
|
|
103
|
+
```powershell
|
|
104
|
+
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=1234 --user-data-dir=C:\Users\YOUR_USER\RFEdgeProfile
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. Start Edge using this shortcut
|
|
108
|
+
|
|
109
|
+
3. Execute `ibrowser`
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## How it works
|
|
113
|
+
|
|
114
|
+
On start up `browser-tray` checks whether `rfbrowser init` has been executed.
|
|
115
|
+
|
|
116
|
+
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 55555`.
|
|
117
|
+
|
|
118
|
+
Selecting "Open Chromium" in the tray icon executes `site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/chromium-XX/chrome-win/chrome.exe --remote-debugging-port=1234 --test-type`.
|
|
119
|
+
|
|
120
|
+
`ibrowser` is a batteries-included [irobot](https://pypi.org/project/robotframework-debug/) that saves time by importing Browser Library and connecting to a running Chromium or Edge.
|
|
121
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# robotframework-browser-tray
|
|
2
|
+
|
|
3
|
+
Tray icon and REPL for trying out [Browser Library](https://robotframework-browser.org/) keywords using Chromium or Edge
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
**Requirements**
|
|
7
|
+
|
|
8
|
+
- NodeJS >= 18
|
|
9
|
+
- Windows
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Use Cases
|
|
13
|
+
|
|
14
|
+
- Execute tests incrementally using e.g. [RobotCode](https://github.com/d-biehl/robotcode)
|
|
15
|
+
|
|
16
|
+
- Test selectors in an open web page interactively
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## How to use it
|
|
20
|
+
|
|
21
|
+
1. Install the package
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install robotframework-browser-tray
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. Execute `browser-tray`
|
|
28
|
+
|
|
29
|
+
**Hint**: In case your environment does not allow executing browser-tray, call the Python module directly:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python -m BrowserTray
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. Click on the tray icon with the Chromium logo
|
|
36
|
+
|
|
37
|
+
4. Open a Terminal and execute `ibrowser`
|
|
38
|
+
|
|
39
|
+
**Hint**: In case your environment does not allow executing ibrowser, call the Python module directly:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m BrowserTray.Repl
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### ibrowser
|
|
46
|
+
|
|
47
|
+
ibrowser allows testing selectors in an open web page interactively.
|
|
48
|
+
|
|
49
|
+
To start it execute:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ibrowser
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
On start up it checks whether the Chromium installed by `rfbrowser init chromium` is present. It can also be used with Microsoft Edge. See the section below for instructions.
|
|
56
|
+
|
|
57
|
+
In addition to the selectors supported by Browser Library, `ibrowser` adds the selector `role` for selecting elements using their ARIA role.
|
|
58
|
+
|
|
59
|
+
The role of an element can be easily obtained from the Accessibility Tree. To open the tree follow these steps:
|
|
60
|
+
|
|
61
|
+
1. Press F12 to open the DevTools
|
|
62
|
+
2. Select the Elements tab
|
|
63
|
+
3. In the right panel click on the Accessibility tab
|
|
64
|
+
4. In the section "Accessibility Tree" check "Enable full-page accessibility tree"
|
|
65
|
+
5. Click the button "Reload DevTools"
|
|
66
|
+
6. In the left panel click on the person icon to toggle the Accessibility Tree view
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Usage in a Robot Framework Test Suite
|
|
70
|
+
|
|
71
|
+
Add these lines to the Settings section of the .robot file:
|
|
72
|
+
|
|
73
|
+
```robotframework
|
|
74
|
+
Library Browser playwright_process_port=55555
|
|
75
|
+
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
In order to use other ports execute:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Using Microsoft Edge
|
|
86
|
+
|
|
87
|
+
If Microsoft Edge is installed on your machine:
|
|
88
|
+
|
|
89
|
+
1. Create a Shortcut to msedge.exe with the target:
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=1234 --user-data-dir=C:\Users\YOUR_USER\RFEdgeProfile
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
2. Start Edge using this shortcut
|
|
96
|
+
|
|
97
|
+
3. Execute `ibrowser`
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## How it works
|
|
101
|
+
|
|
102
|
+
On start up `browser-tray` checks whether `rfbrowser init` has been executed.
|
|
103
|
+
|
|
104
|
+
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 55555`.
|
|
105
|
+
|
|
106
|
+
Selecting "Open Chromium" in the tray icon executes `site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/chromium-XX/chrome-win/chrome.exe --remote-debugging-port=1234 --test-type`.
|
|
107
|
+
|
|
108
|
+
`ibrowser` is a batteries-included [irobot](https://pypi.org/project/robotframework-debug/) that saves time by importing Browser Library and connecting to a running Chromium or Edge.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "robotframework-browser-tray"
|
|
3
|
-
version = "1.
|
|
4
|
-
description = "Tray icon
|
|
3
|
+
version = "1.4.0"
|
|
4
|
+
description = "Tray icon and REPL for trying out Browser Library keywords using Chromium or Edge"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Marduk Bolaños", email = "marduk.bolanos@imbus.de"},
|
|
7
7
|
]
|
|
@@ -10,6 +10,7 @@ urls = { homepage = "https://github.com/mardukbp/robotframework-browser-tray" }
|
|
|
10
10
|
dependencies = [
|
|
11
11
|
"pystray>=0.19.5",
|
|
12
12
|
"robotframework-browser>=18.0.0",
|
|
13
|
+
"robotframework-debug>=4.5.0",
|
|
13
14
|
]
|
|
14
15
|
requires-python = ">=3.8.2"
|
|
15
16
|
readme = "README.md"
|
|
@@ -20,6 +21,7 @@ name = "BrowserTray"
|
|
|
20
21
|
|
|
21
22
|
[project.scripts]
|
|
22
23
|
browser-tray = "BrowserTray.tray:run"
|
|
24
|
+
ibrowser = "BrowserTray.Repl.repl:run"
|
|
23
25
|
|
|
24
26
|
[build-system]
|
|
25
27
|
requires = ["flit_core>=3.2,<4"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
|
|
3
|
+
from RobotDebug.RobotDebug import RobotDebug
|
|
4
|
+
from robot.libraries.BuiltIn import BuiltIn
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Repl(RobotDebug):
|
|
8
|
+
def __init__(self, jsextension=None, **kwargs):
|
|
9
|
+
super().__init__(**kwargs)
|
|
10
|
+
|
|
11
|
+
jsextension = str(pathlib.Path(__file__).parent.resolve() / jsextension).replace('\\', '\\\\')
|
|
12
|
+
self.Library("Browser", "enable_presenter_mode=True", "playwright_process_port=55555", f"jsextension={jsextension}") #
|
|
13
|
+
BuiltIn().run_keyword("Connect To Browser", "http://localhost:1234", "chromium", "use_cdp=True")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
async function registerMySelector(playwright) {
|
|
2
|
+
playwright.selectors.register("role", () => ({
|
|
3
|
+
// Returns the first element matching given selector in the root's subtree.
|
|
4
|
+
query(root, selector) {
|
|
5
|
+
return root.querySelector([role="${selector}"]);
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
// Returns all elements matching given selector in the root's subtree.
|
|
9
|
+
queryAll(root, selector) {
|
|
10
|
+
return Array.from(root.querySelectorAll([role="${selector}"]));
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.__esModule = true;
|
|
18
|
+
exports.registerMySelector = registerMySelector;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import http
|
|
2
|
+
import sys
|
|
3
|
+
import tempfile
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from robot import run_cli
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
TEST_SUITE = b"""
|
|
10
|
+
*** Settings ***
|
|
11
|
+
Library BrowserTray.Repl jsextension=jsextension.js repl=${True}
|
|
12
|
+
|
|
13
|
+
*** Test Cases ***
|
|
14
|
+
Robot Framework Debug REPL
|
|
15
|
+
Debug
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def shell():
|
|
20
|
+
"""A standalone robotframework shell."""
|
|
21
|
+
|
|
22
|
+
default_no_logs = [
|
|
23
|
+
"-l",
|
|
24
|
+
"None",
|
|
25
|
+
"-x",
|
|
26
|
+
"None",
|
|
27
|
+
"-o",
|
|
28
|
+
"None",
|
|
29
|
+
"-L",
|
|
30
|
+
"None",
|
|
31
|
+
"-r",
|
|
32
|
+
"None",
|
|
33
|
+
"--quiet",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
with tempfile.NamedTemporaryFile(
|
|
37
|
+
prefix="robot-debug-", suffix=".robot", delete=False
|
|
38
|
+
) as test_file:
|
|
39
|
+
test_file.write(TEST_SUITE)
|
|
40
|
+
test_file.flush()
|
|
41
|
+
|
|
42
|
+
if len(sys.argv) > 1:
|
|
43
|
+
args = sys.argv[1:] + [test_file.name]
|
|
44
|
+
else:
|
|
45
|
+
args = [*default_no_logs, test_file.name]
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
sys.exit(run_cli(args))
|
|
49
|
+
finally:
|
|
50
|
+
test_file.close()
|
|
51
|
+
# pybot will raise PermissionError on Windows NT or later
|
|
52
|
+
# if NamedTemporaryFile called with `delete=True`,
|
|
53
|
+
# deleting test file seperated will be OK.
|
|
54
|
+
file_path = Path(test_file.name)
|
|
55
|
+
if file_path.exists():
|
|
56
|
+
file_path.unlink()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def run():
|
|
60
|
+
try:
|
|
61
|
+
http.client.HTTPConnection('127.0.0.1', 1234, timeout=1).connect()
|
|
62
|
+
shell()
|
|
63
|
+
except TimeoutError:
|
|
64
|
+
print("ibrowser needs either:\n" +
|
|
65
|
+
" - a running Chromium, started using the tray icon or\n" +
|
|
66
|
+
" - a running Microsoft Edge started as explained in the documentation: https://pypi.org/project/robotframework-browser-tray/"
|
|
67
|
+
)
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/tray.py
RENAMED
|
@@ -6,6 +6,8 @@ import sys
|
|
|
6
6
|
from os.path import realpath
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from subprocess import Popen
|
|
9
|
+
from tkinter import messagebox
|
|
10
|
+
|
|
9
11
|
from PIL import Image
|
|
10
12
|
from pystray import Icon, Menu, MenuItem
|
|
11
13
|
|
|
@@ -14,6 +16,7 @@ _, site_packages = site.getsitepackages()
|
|
|
14
16
|
browser_wrapper = Path(site_packages) / "Browser" / "wrapper"
|
|
15
17
|
index_js = browser_wrapper / "index.js"
|
|
16
18
|
node_modules = browser_wrapper / "node_modules"
|
|
19
|
+
playwright_core = node_modules / "playwright-core"
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
def find_chromium(path: Path) -> list[Path]:
|
|
@@ -24,8 +27,12 @@ def find_chromium(path: Path) -> list[Path]:
|
|
|
24
27
|
]
|
|
25
28
|
|
|
26
29
|
|
|
30
|
+
def playwright_is_initialized():
|
|
31
|
+
return node_modules.is_dir() and playwright_core.is_dir()
|
|
32
|
+
|
|
33
|
+
|
|
27
34
|
def get_chromium_dir(node_modules: Path):
|
|
28
|
-
local_browsers =
|
|
35
|
+
local_browsers = playwright_core / ".local-browsers"
|
|
29
36
|
|
|
30
37
|
if not (node_modules.is_dir() and local_browsers.is_dir() and find_chromium(local_browsers)):
|
|
31
38
|
return None
|
|
@@ -37,16 +44,10 @@ def start_playwright(index_js: Path, playwright_process_port: int) -> Popen:
|
|
|
37
44
|
return Popen(['node', index_js, str(playwright_process_port)])
|
|
38
45
|
|
|
39
46
|
|
|
40
|
-
def start_chromium(chromium_dir: Path, remote_debugging_port: int, incognito: bool) -> Popen:
|
|
41
|
-
incognito_flag = ["-incognito"] if incognito else []
|
|
42
|
-
chrome_exe = chromium_dir / "chrome-win" / "chrome.exe"
|
|
43
|
-
return Popen([chrome_exe, f"--remote-debugging-port={remote_debugging_port}", "--test-type"] + incognito_flag)
|
|
44
|
-
|
|
45
47
|
|
|
46
48
|
class TrayIcon:
|
|
47
|
-
def __init__(self, processes: list[Popen],
|
|
49
|
+
def __init__(self, processes: list[Popen], remote_debugging_port: int):
|
|
48
50
|
chromium_icon = Image.open(Path(realpath(__file__)).parent / "chromium.png")
|
|
49
|
-
self.chromium_dir = chromium_dir
|
|
50
51
|
self.processes = processes
|
|
51
52
|
self.remote_debugging_port = remote_debugging_port
|
|
52
53
|
self.icon = Icon(
|
|
@@ -76,16 +77,25 @@ class TrayIcon:
|
|
|
76
77
|
self.icon.stop()
|
|
77
78
|
|
|
78
79
|
def open_chromium(self):
|
|
79
|
-
|
|
80
|
-
self.processes.append(chromium)
|
|
80
|
+
self.start_chromium(self.remote_debugging_port, False)
|
|
81
81
|
|
|
82
82
|
def open_chromium_incognito(self):
|
|
83
|
-
|
|
84
|
-
self.processes.append(chromium)
|
|
83
|
+
self.start_chromium(self.remote_debugging_port, True)
|
|
85
84
|
|
|
86
85
|
def run(self):
|
|
87
86
|
self.icon.run()
|
|
88
87
|
|
|
88
|
+
def start_chromium(self, remote_debugging_port: int, incognito: bool):
|
|
89
|
+
chromium_dir = get_chromium_dir(node_modules)
|
|
90
|
+
|
|
91
|
+
if not chromium_dir:
|
|
92
|
+
messagebox.showerror("Error", "Chromium is not installed. Execute 'rfbrowser init chromium'.")
|
|
93
|
+
else:
|
|
94
|
+
incognito_flag = ["-incognito"] if incognito else []
|
|
95
|
+
chrome_exe = chromium_dir / "chrome-win" / "chrome.exe"
|
|
96
|
+
chromium = Popen([chrome_exe, f"--remote-debugging-port={remote_debugging_port}", "--test-type"] + incognito_flag)
|
|
97
|
+
self.processes.append(chromium)
|
|
98
|
+
|
|
89
99
|
|
|
90
100
|
def is_running(cmd: str) -> bool:
|
|
91
101
|
process_list = subprocess.check_output(
|
|
@@ -125,12 +135,16 @@ def run():
|
|
|
125
135
|
sys.exit(1)
|
|
126
136
|
|
|
127
137
|
playwright_process_port, remote_debugging_port = get_ports()
|
|
128
|
-
chromium_dir = get_chromium_dir(node_modules)
|
|
129
138
|
|
|
130
|
-
if not
|
|
131
|
-
|
|
139
|
+
if not playwright_is_initialized():
|
|
140
|
+
print(
|
|
141
|
+
"Playwright has not been initialized.\n" +
|
|
142
|
+
"In order to use Chromium execute 'rfbrowser init chromium'.\n" +
|
|
143
|
+
"If you want to use the Microsoft Edge installed on your system execute 'rfbrowser init --skip-browsers'"
|
|
144
|
+
)
|
|
145
|
+
sys.exit(1)
|
|
132
146
|
|
|
133
147
|
playwright_process = start_playwright(index_js, playwright_process_port)
|
|
134
148
|
processes = [playwright_process]
|
|
135
|
-
tray_icon = TrayIcon(processes,
|
|
149
|
+
tray_icon = TrayIcon(processes, remote_debugging_port)
|
|
136
150
|
tray_icon.run()
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: robotframework-browser-tray
|
|
3
|
-
Version: 1.2.2
|
|
4
|
-
Summary: Tray icon to start the Chromium installed by Browser Library
|
|
5
|
-
Author-email: Marduk Bolaños <marduk.bolanos@imbus.de>
|
|
6
|
-
Requires-Python: >=3.8.2
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist: pystray>=0.19.5
|
|
9
|
-
Requires-Dist: robotframework-browser>=18.0.0
|
|
10
|
-
Project-URL: homepage, https://github.com/mardukbp/robotframework-browser-tray
|
|
11
|
-
|
|
12
|
-
# robotframework-browser-tray
|
|
13
|
-
|
|
14
|
-
A tray icon for starting the Chromium installed by [Browser Library](https://robotframework-browser.org/)
|
|
15
|
-
|
|
16
|
-
**Requirements**
|
|
17
|
-
|
|
18
|
-
- NodeJS >= 18
|
|
19
|
-
- Windows
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Use Cases
|
|
23
|
-
|
|
24
|
-
- Execute tests incrementally using e.g. [RobotCode](https://github.com/d-biehl/robotcode)
|
|
25
|
-
|
|
26
|
-
- Test selectors in an open web page interactively using [irobot](https://pypi.org/project/robotframework-debug/)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## How to use it
|
|
30
|
-
|
|
31
|
-
1. Install the package
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pip install robotframework-browser-tray
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
2. Execute `browser-tray`
|
|
38
|
-
|
|
39
|
-
**Hint**: In case your environment does not allow executing browser-tray, call the Python module directly:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
python -m BrowserTray
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
3a. Click on the tray icon with the Chromium logo and select `Open Chromium`
|
|
46
|
-
|
|
47
|
-
3b. If Microsoft Edge is installed on your machine:
|
|
48
|
-
|
|
49
|
-
1. Close all instances of Microsoft Edge
|
|
50
|
-
|
|
51
|
-
```powershell
|
|
52
|
-
taskkill /F /IM msedge.exe
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2. Start Microsoft Edge with `Windows + R`
|
|
56
|
-
|
|
57
|
-
```powershell
|
|
58
|
-
msedge.exe --remote-debugging-port=1234
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
4. Add these lines to the top of the .robot file with your tests:
|
|
62
|
-
|
|
63
|
-
```robotframework
|
|
64
|
-
Library Browser playwright_process_port=55555
|
|
65
|
-
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
In order to use other ports execute:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## How it works
|
|
75
|
-
|
|
76
|
-
On start up it checks whether `rfbrowser init chromium` has been executed in the current environment.
|
|
77
|
-
|
|
78
|
-
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 55555`.
|
|
79
|
-
|
|
80
|
-
Selecting "Open Chromium" in the tray icon executes `site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/chromium-XX/chrome-win/chrome.exe --remote-debugging-port=1234 --test-type`.
|
|
81
|
-
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# robotframework-browser-tray
|
|
2
|
-
|
|
3
|
-
A tray icon for starting the Chromium installed by [Browser Library](https://robotframework-browser.org/)
|
|
4
|
-
|
|
5
|
-
**Requirements**
|
|
6
|
-
|
|
7
|
-
- NodeJS >= 18
|
|
8
|
-
- Windows
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Use Cases
|
|
12
|
-
|
|
13
|
-
- Execute tests incrementally using e.g. [RobotCode](https://github.com/d-biehl/robotcode)
|
|
14
|
-
|
|
15
|
-
- Test selectors in an open web page interactively using [irobot](https://pypi.org/project/robotframework-debug/)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## How to use it
|
|
19
|
-
|
|
20
|
-
1. Install the package
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
pip install robotframework-browser-tray
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
2. Execute `browser-tray`
|
|
27
|
-
|
|
28
|
-
**Hint**: In case your environment does not allow executing browser-tray, call the Python module directly:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
python -m BrowserTray
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
3a. Click on the tray icon with the Chromium logo and select `Open Chromium`
|
|
35
|
-
|
|
36
|
-
3b. If Microsoft Edge is installed on your machine:
|
|
37
|
-
|
|
38
|
-
1. Close all instances of Microsoft Edge
|
|
39
|
-
|
|
40
|
-
```powershell
|
|
41
|
-
taskkill /F /IM msedge.exe
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
2. Start Microsoft Edge with `Windows + R`
|
|
45
|
-
|
|
46
|
-
```powershell
|
|
47
|
-
msedge.exe --remote-debugging-port=1234
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
4. Add these lines to the top of the .robot file with your tests:
|
|
51
|
-
|
|
52
|
-
```robotframework
|
|
53
|
-
Library Browser playwright_process_port=55555
|
|
54
|
-
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
In order to use other ports execute:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## How it works
|
|
64
|
-
|
|
65
|
-
On start up it checks whether `rfbrowser init chromium` has been executed in the current environment.
|
|
66
|
-
|
|
67
|
-
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 55555`.
|
|
68
|
-
|
|
69
|
-
Selecting "Open Chromium" in the tray icon executes `site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/chromium-XX/chrome-win/chrome.exe --remote-debugging-port=1234 --test-type`.
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/__init__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/__main__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.4.0}/src/BrowserTray/chromium.png
RENAMED
|
File without changes
|