robotframework-browser-tray 1.2.2__tar.gz → 1.3.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.2.2 → robotframework_browser_tray-1.3.0}/PKG-INFO +43 -11
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/README.md +41 -10
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/pyproject.toml +3 -1
- robotframework_browser_tray-1.3.0/src/BrowserTray/BrowserRepl/__init__.py +12 -0
- robotframework_browser_tray-1.3.0/src/BrowserTray/BrowserRepl/__main__.py +3 -0
- robotframework_browser_tray-1.3.0/src/BrowserTray/BrowserRepl/jsextension.js +18 -0
- robotframework_browser_tray-1.3.0/src/BrowserTray/BrowserRepl/repl.py +63 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/__init__.py +0 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/__main__.py +0 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/chromium.png +0 -0
- {robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/tray.py +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotframework-browser-tray
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Tray icon to start the Chromium installed by Browser Library
|
|
5
5
|
Author-email: Marduk Bolaños <marduk.bolanos@imbus.de>
|
|
6
6
|
Requires-Python: >=3.8.2
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Requires-Dist: pystray>=0.19.5
|
|
9
9
|
Requires-Dist: robotframework-browser>=18.0.0
|
|
10
|
+
Requires-Dist: robotframework-debug>=4.5.0
|
|
10
11
|
Project-URL: homepage, https://github.com/mardukbp/robotframework-browser-tray
|
|
11
12
|
|
|
12
13
|
# robotframework-browser-tray
|
|
@@ -42,23 +43,34 @@ pip install robotframework-browser-tray
|
|
|
42
43
|
python -m BrowserTray
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
3. Click on the tray icon with the Chromium logo
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
4. Open a Terminal and execute `ibrowser`
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
**Hint**: In case your environment does not allow executing ibrowser, call the Python module directly:
|
|
50
51
|
|
|
51
|
-
```
|
|
52
|
-
|
|
52
|
+
```bash
|
|
53
|
+
python -m BrowserTray.BrowserRepl
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
### ibrowser
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```
|
|
58
|
+
ibrowser allows testing selectors in an open web page interactively. In addition to the selectors supported by Browser library,
|
|
59
|
+
it adds the selector `role` for selecting elements using their ARIA role.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
The role of an element can be easily obtained from the Accessibility Tree. To open the tree follow these steps:
|
|
62
|
+
|
|
63
|
+
1. Press F12 to open the DevTools
|
|
64
|
+
2. Select the Elements tab
|
|
65
|
+
3. In the right panel click on the Accessibility tab
|
|
66
|
+
4. In the section "Accessibility Tree" check "Enable full-page accessibility tree"
|
|
67
|
+
5. Click the button "Reload DevTools"
|
|
68
|
+
6. In the left panel click on the person icon to toggle the Accessibility Tree view
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Usage in a Robot Framework Test Suite
|
|
72
|
+
|
|
73
|
+
Add these lines to the top of the .robot file:
|
|
62
74
|
|
|
63
75
|
```robotframework
|
|
64
76
|
Library Browser playwright_process_port=55555
|
|
@@ -71,6 +83,24 @@ In order to use other ports execute:
|
|
|
71
83
|
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
72
84
|
```
|
|
73
85
|
|
|
86
|
+
|
|
87
|
+
### Using Microsoft Edge
|
|
88
|
+
|
|
89
|
+
If Microsoft Edge is installed on your machine:
|
|
90
|
+
|
|
91
|
+
1. Close all instances of Microsoft Edge
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
taskkill /F /IM msedge.exe
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. Start Microsoft Edge with `Windows + R`
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
msedge.exe --remote-debugging-port=1234
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
|
|
74
104
|
## How it works
|
|
75
105
|
|
|
76
106
|
On start up it checks whether `rfbrowser init chromium` has been executed in the current environment.
|
|
@@ -79,3 +109,5 @@ If this requirement is met the Playwright wrapper is started with `node site-pac
|
|
|
79
109
|
|
|
80
110
|
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
111
|
|
|
112
|
+
`ibrowser` is a batteries-included irobot that imports Browser library, connects to Chromium (if it is running) and adds some convenient selectors.
|
|
113
|
+
|
|
@@ -31,23 +31,34 @@ pip install robotframework-browser-tray
|
|
|
31
31
|
python -m BrowserTray
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
3. Click on the tray icon with the Chromium logo
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
4. Open a Terminal and execute `ibrowser`
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
**Hint**: In case your environment does not allow executing ibrowser, call the Python module directly:
|
|
39
39
|
|
|
40
|
-
```
|
|
41
|
-
|
|
40
|
+
```bash
|
|
41
|
+
python -m BrowserTray.BrowserRepl
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### ibrowser
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
46
|
+
ibrowser allows testing selectors in an open web page interactively. In addition to the selectors supported by Browser library,
|
|
47
|
+
it adds the selector `role` for selecting elements using their ARIA role.
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
The role of an element can be easily obtained from the Accessibility Tree. To open the tree follow these steps:
|
|
50
|
+
|
|
51
|
+
1. Press F12 to open the DevTools
|
|
52
|
+
2. Select the Elements tab
|
|
53
|
+
3. In the right panel click on the Accessibility tab
|
|
54
|
+
4. In the section "Accessibility Tree" check "Enable full-page accessibility tree"
|
|
55
|
+
5. Click the button "Reload DevTools"
|
|
56
|
+
6. In the left panel click on the person icon to toggle the Accessibility Tree view
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Usage in a Robot Framework Test Suite
|
|
60
|
+
|
|
61
|
+
Add these lines to the top of the .robot file:
|
|
51
62
|
|
|
52
63
|
```robotframework
|
|
53
64
|
Library Browser playwright_process_port=55555
|
|
@@ -60,6 +71,24 @@ In order to use other ports execute:
|
|
|
60
71
|
browser-tray --pw-port=XXXX --cdp-port=XXXX
|
|
61
72
|
```
|
|
62
73
|
|
|
74
|
+
|
|
75
|
+
### Using Microsoft Edge
|
|
76
|
+
|
|
77
|
+
If Microsoft Edge is installed on your machine:
|
|
78
|
+
|
|
79
|
+
1. Close all instances of Microsoft Edge
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
taskkill /F /IM msedge.exe
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
2. Start Microsoft Edge with `Windows + R`
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
msedge.exe --remote-debugging-port=1234
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
63
92
|
## How it works
|
|
64
93
|
|
|
65
94
|
On start up it checks whether `rfbrowser init chromium` has been executed in the current environment.
|
|
@@ -67,3 +96,5 @@ On start up it checks whether `rfbrowser init chromium` has been executed in the
|
|
|
67
96
|
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 55555`.
|
|
68
97
|
|
|
69
98
|
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`.
|
|
99
|
+
|
|
100
|
+
`ibrowser` is a batteries-included irobot that imports Browser library, connects to Chromium (if it is running) and adds some convenient selectors.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "robotframework-browser-tray"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.3.0"
|
|
4
4
|
description = "Tray icon to start the Chromium installed by Browser Library"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Marduk Bolaños", email = "marduk.bolanos@imbus.de"},
|
|
@@ -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.BrowserRepl.repl:run"
|
|
23
25
|
|
|
24
26
|
[build-system]
|
|
25
27
|
requires = ["flit_core>=3.2,<4"]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from RobotDebug.RobotDebug import RobotDebug
|
|
2
|
+
from robot.libraries.BuiltIn import BuiltIn
|
|
3
|
+
import pathlib
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BrowserRepl(RobotDebug):
|
|
7
|
+
def __init__(self, jsextension=None, **kwargs):
|
|
8
|
+
super().__init__(**kwargs)
|
|
9
|
+
|
|
10
|
+
jsextension = str(pathlib.Path(__file__).parent.resolve() / jsextension).replace('\\', '\\\\')
|
|
11
|
+
self.Library("Browser", "playwright_process_port=55555", f"jsextension={jsextension}") #
|
|
12
|
+
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,63 @@
|
|
|
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.BrowserRepl 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
|
+
def run():
|
|
59
|
+
try:
|
|
60
|
+
http.client.HTTPConnection('127.0.0.1', 1234, timeout=1).connect()
|
|
61
|
+
shell()
|
|
62
|
+
except TimeoutError:
|
|
63
|
+
print("ibrowser needs a running Chromium, started using the tray icon")
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/__init__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/__main__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/chromium.png
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.2.2 → robotframework_browser_tray-1.3.0}/src/BrowserTray/tray.py
RENAMED
|
File without changes
|