robotframework-browser-tray 1.7.0__tar.gz → 1.8.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.7.0 → robotframework_browser_tray-1.8.0}/PKG-INFO +5 -9
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/README.md +4 -8
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/pyproject.toml +1 -1
- robotframework_browser_tray-1.8.0/src/BrowserTray/BrowserRepl/__init__.py +15 -0
- robotframework_browser_tray-1.8.0/src/BrowserTray/cmdline_args.py +17 -0
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/ibrowser/repl.py +5 -10
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/tray.py +1 -1
- robotframework_browser_tray-1.7.0/src/BrowserTray/BrowserRepl/__init__.py +0 -14
- robotframework_browser_tray-1.7.0/src/BrowserTray/cmdline_args.py +0 -22
- robotframework_browser_tray-1.7.0/src/BrowserTray/playwright.py +0 -44
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/__init__.py +0 -0
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/__main__.py +0 -0
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/chromium.png +0 -0
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/ibrowser/__init__.py +0 -0
- {robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/ibrowser/__main__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: robotframework-browser-tray
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Tray icon and REPL for trying out Browser Library keywords using Chromium or Edge
|
|
5
5
|
Author-email: Marduk Bolaños <marduk.bolanos@imbus.de>
|
|
6
6
|
Requires-Python: >=3.9.0
|
|
@@ -75,14 +75,14 @@ To exit ibrowser press `Ctrl-D`.
|
|
|
75
75
|
Add these lines to the Settings section of the .robot file:
|
|
76
76
|
|
|
77
77
|
```robotframework
|
|
78
|
-
Library Browser
|
|
79
|
-
Test Setup Connect To Browser http://localhost:1234
|
|
78
|
+
Library Browser
|
|
79
|
+
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
In order to use
|
|
82
|
+
In order to use another port execute:
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
browser-tray --
|
|
85
|
+
browser-tray --cdp-port=XXXX
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
|
|
@@ -103,10 +103,6 @@ If Microsoft Edge is installed on your machine:
|
|
|
103
103
|
|
|
104
104
|
## How it works
|
|
105
105
|
|
|
106
|
-
On start up `ibrowser` checks whether `rfbrowser init` has been executed.
|
|
107
|
-
|
|
108
|
-
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 4711`.
|
|
109
|
-
|
|
110
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`.
|
|
111
107
|
|
|
112
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.
|
|
@@ -63,14 +63,14 @@ To exit ibrowser press `Ctrl-D`.
|
|
|
63
63
|
Add these lines to the Settings section of the .robot file:
|
|
64
64
|
|
|
65
65
|
```robotframework
|
|
66
|
-
Library Browser
|
|
67
|
-
Test Setup Connect To Browser http://localhost:1234
|
|
66
|
+
Library Browser
|
|
67
|
+
Test Setup Connect To Browser http://localhost:1234 chromium use_cdp=True
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
In order to use
|
|
70
|
+
In order to use another port execute:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
browser-tray --
|
|
73
|
+
browser-tray --cdp-port=XXXX
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
|
|
@@ -91,10 +91,6 @@ If Microsoft Edge is installed on your machine:
|
|
|
91
91
|
|
|
92
92
|
## How it works
|
|
93
93
|
|
|
94
|
-
On start up `ibrowser` checks whether `rfbrowser init` has been executed.
|
|
95
|
-
|
|
96
|
-
If this requirement is met the Playwright wrapper is started with `node site-packages/Browser/wrapper/index.js 4711`.
|
|
97
|
-
|
|
98
94
|
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
95
|
|
|
100
96
|
`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.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from RobotDebug.RobotDebug import RobotDebug
|
|
2
|
+
from robot.libraries.BuiltIn import BuiltIn
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class BrowserRepl(RobotDebug):
|
|
6
|
+
def __init__(self, remote_debugging_port, **kwargs):
|
|
7
|
+
super().__init__(**kwargs)
|
|
8
|
+
|
|
9
|
+
self.remote_debugging_port = remote_debugging_port
|
|
10
|
+
self.Library("Browser", "enable_presenter_mode=True")
|
|
11
|
+
self.connect()
|
|
12
|
+
|
|
13
|
+
def connect(self):
|
|
14
|
+
BuiltIn().run_keyword("Connect To Browser", f"http://localhost:{self.remote_debugging_port}", "chromium", "use_cdp=True")
|
|
15
|
+
BuiltIn().run_keyword("Set Browser Timeout", "2s")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
REMOTE_DEBUGGING_PORT = 1234
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_remote_debugging_port() -> int:
|
|
8
|
+
arg_parser = argparse.ArgumentParser(add_help=True)
|
|
9
|
+
arg_parser.add_argument(
|
|
10
|
+
"--cdp-port",
|
|
11
|
+
default=REMOTE_DEBUGGING_PORT,
|
|
12
|
+
type=int,
|
|
13
|
+
help=f"Chromium debugging port (default: {REMOTE_DEBUGGING_PORT})"
|
|
14
|
+
)
|
|
15
|
+
args = arg_parser.parse_args()
|
|
16
|
+
|
|
17
|
+
return args.cdp_port
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import http.client
|
|
2
2
|
import re
|
|
3
3
|
import socket
|
|
4
|
-
from subprocess import Popen
|
|
5
4
|
import sys
|
|
6
5
|
import tempfile
|
|
7
6
|
import time
|
|
@@ -15,7 +14,6 @@ from robot.run import run_cli
|
|
|
15
14
|
from robot.api import logger
|
|
16
15
|
|
|
17
16
|
from BrowserTray import cmdline_args
|
|
18
|
-
from BrowserTray import playwright
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
def escape_ansi(line):
|
|
@@ -58,11 +56,11 @@ def wrap_presenter_mode(self, selector, strict):
|
|
|
58
56
|
LibraryComponent.presenter_mode = wrap_presenter_mode
|
|
59
57
|
|
|
60
58
|
|
|
61
|
-
def test_suite(
|
|
59
|
+
def test_suite(remote_debugging_port):
|
|
62
60
|
return bytes(dedent(
|
|
63
61
|
f"""
|
|
64
62
|
*** Settings ***
|
|
65
|
-
Library BrowserTray.BrowserRepl {
|
|
63
|
+
Library BrowserTray.BrowserRepl {remote_debugging_port} repl=${True}
|
|
66
64
|
|
|
67
65
|
*** Test Cases ***
|
|
68
66
|
Robot Framework Debug REPL
|
|
@@ -73,7 +71,7 @@ def test_suite(playwright_process_port, remote_debugging_port):
|
|
|
73
71
|
)
|
|
74
72
|
|
|
75
73
|
|
|
76
|
-
def irobot(testsuite: bytes
|
|
74
|
+
def irobot(testsuite: bytes):
|
|
77
75
|
"""A standalone robotframework shell."""
|
|
78
76
|
|
|
79
77
|
default_no_logs = [
|
|
@@ -117,18 +115,15 @@ def irobot(testsuite: bytes, playwright_proc: Popen):
|
|
|
117
115
|
file_path = Path(test_file.name)
|
|
118
116
|
if file_path.exists():
|
|
119
117
|
file_path.unlink()
|
|
120
|
-
|
|
121
|
-
playwright_proc.terminate()
|
|
122
118
|
|
|
123
119
|
|
|
124
120
|
def run():
|
|
125
|
-
|
|
121
|
+
remote_debugging_port = cmdline_args.get_remote_debugging_port()
|
|
126
122
|
|
|
127
123
|
try:
|
|
128
124
|
http.client.HTTPConnection('127.0.0.1', remote_debugging_port, timeout=1).connect()
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
irobot(test_suite(playwright_process_port, remote_debugging_port), playwright_proc)
|
|
126
|
+
irobot(test_suite(remote_debugging_port))
|
|
132
127
|
except socket.timeout:
|
|
133
128
|
print("ibrowser needs either:\n" +
|
|
134
129
|
" - a running Chromium, started using the tray icon or\n" +
|
{robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/tray.py
RENAMED
|
@@ -109,6 +109,6 @@ def is_running(cmd: str) -> bool:
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
def run():
|
|
112
|
-
|
|
112
|
+
remote_debugging_port = cmdline_args.get_remote_debugging_port()
|
|
113
113
|
tray_icon = TrayIcon(remote_debugging_port)
|
|
114
114
|
tray_icon.run()
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from RobotDebug.RobotDebug import RobotDebug
|
|
2
|
-
from robot.libraries.BuiltIn import BuiltIn
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class BrowserRepl(RobotDebug):
|
|
6
|
-
def __init__(self, playwright_process_port, remote_debugging_port, **kwargs):
|
|
7
|
-
super().__init__(**kwargs)
|
|
8
|
-
|
|
9
|
-
self.Library("Browser", "enable_presenter_mode=True", f"playwright_process_port={playwright_process_port}")
|
|
10
|
-
self.connect(remote_debugging_port)
|
|
11
|
-
|
|
12
|
-
def connect(self, remote_debugging_port):
|
|
13
|
-
BuiltIn().run_keyword("Connect To Browser", f"http://localhost:{remote_debugging_port}", "chromium", "use_cdp=True")
|
|
14
|
-
BuiltIn().run_keyword("Set Browser Timeout", "2s")
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from typing import Tuple
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
REMOTE_DEBUGGING_PORT = 1234
|
|
6
|
-
PLAYWRIGHT_PROCESS_PORT= 4711
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_ports() -> Tuple[int, int]:
|
|
10
|
-
MAX_PORT = 2**16
|
|
11
|
-
|
|
12
|
-
arg_parser = argparse.ArgumentParser(add_help=True)
|
|
13
|
-
arg_parser.add_argument("--pw-port", default=PLAYWRIGHT_PROCESS_PORT, type=int, help=f"Playwright process port (default: {PLAYWRIGHT_PROCESS_PORT})")
|
|
14
|
-
arg_parser.add_argument("--cdp-port", default=REMOTE_DEBUGGING_PORT, type=int, help=f"Chromium debugging port (default: {REMOTE_DEBUGGING_PORT})")
|
|
15
|
-
args = arg_parser.parse_args()
|
|
16
|
-
playwright_process_port = args.pw_port
|
|
17
|
-
remote_debugging_port = args.cdp_port
|
|
18
|
-
|
|
19
|
-
if playwright_process_port > MAX_PORT or remote_debugging_port > MAX_PORT:
|
|
20
|
-
raise ValueError(f"Port numbers cannot be larger than {MAX_PORT}")
|
|
21
|
-
|
|
22
|
-
return (playwright_process_port, remote_debugging_port)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import http.client
|
|
2
|
-
import site
|
|
3
|
-
import socket
|
|
4
|
-
import subprocess
|
|
5
|
-
import sys
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
from subprocess import Popen
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_, site_packages = site.getsitepackages()
|
|
11
|
-
browser_wrapper = Path(site_packages) / "Browser" / "wrapper"
|
|
12
|
-
index_js = browser_wrapper / "index.js"
|
|
13
|
-
node_modules = browser_wrapper / "node_modules"
|
|
14
|
-
playwright_core = node_modules / "playwright-core"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def playwright_is_initialized():
|
|
18
|
-
return node_modules.is_dir() and playwright_core.is_dir()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def start_playwright(playwright_process_port: int) -> Popen:
|
|
22
|
-
return Popen(
|
|
23
|
-
['node', index_js, str(playwright_process_port)],
|
|
24
|
-
stderr=subprocess.PIPE,
|
|
25
|
-
stdout=subprocess.PIPE
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def run(playwright_process_port: int) -> Popen:
|
|
30
|
-
if not playwright_is_initialized():
|
|
31
|
-
print(
|
|
32
|
-
"Playwright has not been initialized.\n" +
|
|
33
|
-
"In order to use Chromium execute 'rfbrowser init chromium'.\n" +
|
|
34
|
-
"If you want to use the Microsoft Edge installed on your system execute 'rfbrowser init --skip-browsers'"
|
|
35
|
-
)
|
|
36
|
-
sys.exit(1)
|
|
37
|
-
|
|
38
|
-
try:
|
|
39
|
-
http.client.HTTPConnection('127.0.0.1', playwright_process_port, timeout=1).connect()
|
|
40
|
-
print(f"The port {playwright_process_port} is already in use. Either browser-tray is already running or another process is using the port.\n" +
|
|
41
|
-
"To start the Playwright wrapper on another port execute `browser-tray --pw-port PORT`")
|
|
42
|
-
sys.exit(1)
|
|
43
|
-
except socket.timeout:
|
|
44
|
-
return start_playwright(playwright_process_port)
|
{robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/__init__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/__main__.py
RENAMED
|
File without changes
|
{robotframework_browser_tray-1.7.0 → robotframework_browser_tray-1.8.0}/src/BrowserTray/chromium.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|