Skip to content

Commit d17632a

Browse files
committed
fixed linux installation issue
1 parent 213015b commit d17632a

3 files changed

Lines changed: 30 additions & 24 deletions

File tree

Framework/Built_In_Automation/Desktop/Linux/BuiltInFunctions.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,27 +235,12 @@ def capture_screenshot(file_path: str, app_name: str | None = None) -> bool:
235235
if os.path.exists(file_path) and os.path.getsize(file_path) > 0:
236236
return True
237237
except FileNotFoundError:
238-
# xwd not present; fallback to previously supported tools
239-
pass
238+
# xwd not present
239+
CommonUtil.ExecLog(MODULE_NAME, "xwd command not found", 3)
240240
except Exception as e:
241241
CommonUtil.ExecLog(MODULE_NAME, f"xwd/convert screenshot failed: {e}", 3)
242242

243-
# Fallback: try scrot / gnome-screenshot / import (root window capture) like before
244-
tools = [
245-
["scrot", file_path],
246-
["gnome-screenshot", "-f", file_path],
247-
["import", "-window", "root", file_path]
248-
]
249-
250-
for cmd in tools:
251-
try:
252-
subprocess.run(cmd, check=True, capture_output=True)
253-
if os.path.exists(file_path) and os.path.getsize(file_path) > 0:
254-
return True
255-
except (subprocess.CalledProcessError, FileNotFoundError):
256-
continue
257-
258-
CommonUtil.ExecLog(MODULE_NAME, "Failed to capture screenshot. Ensure xwd/xdotool and at least one screenshot tool like scrot, gnome-screenshot, or imagemagick are installed.", 3)
243+
CommonUtil.ExecLog(MODULE_NAME, "Failed to capture screenshot. Ensure xwd, xdotool, and ImageMagick (convert) are installed.", 3)
259244
return False
260245

261246

Installer/setup_linux_inspector.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ APT_PACKAGES=(
1010
libgirepository1.0-dev
1111
libcairo2-dev
1212
xdotool
13-
scrot
13+
x11-apps # provides xwd
14+
imagemagick # provides convert, import
15+
wmctrl
1416
)
1517

1618
DNF_PACKAGES=(
@@ -19,9 +21,11 @@ DNF_PACKAGES=(
1921
gobject-introspection-devel
2022
cairo-devel
2123
xdotool
24+
xorg-x11-utils # provides xwd on some distros
25+
ImageMagick
26+
wmctrl
2227
python3-devel
2328
cairo-gobject-devel
24-
scrot
2529
)
2630

2731
PACMAN_PACKAGES=(
@@ -32,7 +36,8 @@ PACMAN_PACKAGES=(
3236
cairo
3337
xdotool
3438
gobject-introspection
35-
scrot
39+
imagemagick
40+
wmctrl
3641
)
3742

3843
BREW_PACKAGES=(
@@ -41,7 +46,7 @@ BREW_PACKAGES=(
4146
cairo
4247
xdotool
4348
gobject-introspection
44-
scrot
49+
imagemagick
4550
)
4651

4752
# Function to join array into space-separated string
@@ -74,3 +79,16 @@ else
7479
fi
7580

7681
echo "✅ Installation complete."
82+
83+
# Post-install sanity checks for screenshot/capture utilities
84+
echo "\nChecking availability of key utilities:"
85+
REQUIRED_TOOLS=(xdotool xwd convert import wmctrl)
86+
for t in "${REQUIRED_TOOLS[@]}"; do
87+
if command -v "$t" >/dev/null 2>&1; then
88+
echo " - $t: available"
89+
else
90+
echo " - $t: NOT FOUND"
91+
fi
92+
done
93+
94+
echo "If any of the above are missing, please install them for full Linux inspector functionality."

node_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,6 @@ async def command_line_args() -> Path | None:
11731173

11741174
# Desktop automation and UI inspection options
11751175
install_linux_deps = all_arguments.install_linux_deps
1176-
list_apps = all_arguments.list_apps
1177-
dump_ui = all_arguments.dump_ui
11781176

11791177
# Handle RSA key management commands
11801178
if generate_key:
@@ -1201,6 +1199,11 @@ async def command_line_args() -> Path | None:
12011199
sys.exit(0)
12021200
else:
12031201
sys.exit(1)
1202+
if install_linux_deps:
1203+
if install_linux_inspector_deps():
1204+
sys.exit(0)
1205+
else:
1206+
sys.exit(1)
12041207

12051208
# Update chrome extension download settings if specified
12061209
if chrome_fetch is not None:

0 commit comments

Comments
 (0)