Skip to content

Commit b694e46

Browse files
authored
Merge pull request #3855 from seleniumbase/fix-pyautogui-targeting-on-linux
Fix PyAutoGUI targeting issue on Linux
2 parents 69f6ae8 + 87639dd commit b694e46

File tree

8 files changed

+55
-19
lines changed

8 files changed

+55
-19
lines changed

mkdocs_build/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pathspec==0.12.1
1414
Babel==2.17.0
1515
paginate==0.5.7
1616
mkdocs==1.6.1
17-
mkdocs-material==9.6.14
17+
mkdocs-material==9.6.15
1818
mkdocs-exclude-search==0.6.6
1919
mkdocs-simple-hooks==0.1.5
2020
mkdocs-material-extensions==1.3.1

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ parse>=1.20.2
2626
parse-type>=0.6.4
2727
colorama>=0.4.6
2828
pyyaml>=6.0.2
29-
pygments>=2.19.1
29+
pygments>=2.19.2
3030
pyreadline3>=3.5.3;platform_system=="Windows"
3131
tabcompleter>=1.4.0
3232
pdbp>=1.7.0
3333
idna==3.10
3434
chardet==5.2.0
3535
charset-normalizer>=3.4.2,<4
3636
urllib3>=1.26.20,<2;python_version<"3.10"
37-
urllib3>=1.26.20,<2.5.0;python_version>="3.10"
37+
urllib3>=1.26.20,<2.6.0;python_version>="3.10"
3838
requests==2.32.4
3939
sniffio==1.3.1
4040
h11==0.16.0
@@ -55,14 +55,14 @@ iniconfig==2.1.0
5555
pluggy==1.5.0;python_version<"3.9"
5656
pluggy==1.6.0;python_version>="3.9"
5757
pytest==8.3.5;python_version<"3.9"
58-
pytest==8.4.0;python_version>="3.9"
58+
pytest==8.4.1;python_version>="3.9"
5959
pytest-html==4.0.2
6060
pytest-metadata==3.1.1
6161
pytest-ordering==0.6
6262
pytest-rerunfailures==14.0;python_version<"3.9"
6363
pytest-rerunfailures==15.1;python_version>="3.9"
6464
pytest-xdist==3.6.1;python_version<"3.9"
65-
pytest-xdist==3.7.0;python_version>="3.9"
65+
pytest-xdist==3.8.0;python_version>="3.9"
6666
parameterized==0.9.0
6767
behave==1.2.6
6868
soupsieve==2.7
@@ -81,9 +81,9 @@ coverage>=7.9.1;python_version>="3.9"
8181
pytest-cov>=5.0.0;python_version<"3.9"
8282
pytest-cov>=6.2.1;python_version>="3.9"
8383
flake8==5.0.4;python_version<"3.9"
84-
flake8==7.2.0;python_version>="3.9"
84+
flake8==7.3.0;python_version>="3.9"
8585
mccabe==0.7.0
8686
pyflakes==2.5.0;python_version<"3.9"
87-
pyflakes==3.3.2;python_version>="3.9"
87+
pyflakes==3.4.0;python_version>="3.9"
8888
pycodestyle==2.9.1;python_version<"3.9"
89-
pycodestyle==2.13.0;python_version>="3.9"
89+
pycodestyle==2.14.0;python_version>="3.9"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.39.5"
2+
__version__ = "4.39.6"

seleniumbase/core/browser_launcher.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,16 @@ def uc_open_with_cdp_mode(driver, url=None, **kwargs):
580580
headless = False
581581
headed = None
582582
xvfb = None
583+
xvfb_metrics = None
583584
binary_location = None
584585
if hasattr(sb_config, "headless"):
585586
headless = sb_config.headless
586587
if hasattr(sb_config, "headed"):
587588
headed = sb_config.headed
588589
if hasattr(sb_config, "xvfb"):
589590
xvfb = sb_config.xvfb
591+
if hasattr(sb_config, "xvfb_metrics"):
592+
xvfb_metrics = sb_config.xvfb_metrics
590593
if hasattr(sb_config, "binary_location"):
591594
binary_location = sb_config.binary_location
592595

@@ -599,6 +602,7 @@ def uc_open_with_cdp_mode(driver, url=None, **kwargs):
599602
headless=headless,
600603
headed=headed,
601604
xvfb=xvfb,
605+
xvfb_metrics=xvfb_metrics,
602606
browser_executable_path=binary_location,
603607
)
604608
)
@@ -963,6 +967,11 @@ def __install_pyautogui_if_missing():
963967
backend="xvfb",
964968
use_xauth=True,
965969
)
970+
if "--debug-display" in sys.argv:
971+
print(
972+
"Starting VDisplay from browser_launcher: (%s, %s)"
973+
% (xvfb_width, xvfb_height)
974+
)
966975
_xvfb_display.start()
967976
sb_config._virtual_display = _xvfb_display
968977
sb_config.headless_active = True

seleniumbase/core/sb_cdp.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,10 @@ def __install_pyautogui_if_missing(self):
14391439
shared_utils.is_linux()
14401440
and (not sb_config.headed or sb_config.xvfb)
14411441
and not driver.config.headless
1442+
and (
1443+
not hasattr(sb_config, "_virtual_display")
1444+
or not sb_config._virtual_display
1445+
)
14421446
):
14431447
from sbvirtualdisplay import Display
14441448
xvfb_width = 1366
@@ -1466,6 +1470,11 @@ def __install_pyautogui_if_missing(self):
14661470
backend="xvfb",
14671471
use_xauth=True,
14681472
)
1473+
if "--debug-display" in sys.argv:
1474+
print(
1475+
"Starting VDisplay from sb_cdp: (%s, %s)"
1476+
% (xvfb_width, xvfb_height)
1477+
)
14691478
xvfb_display.start()
14701479

14711480
def __get_configured_pyautogui(self, pyautogui_copy):

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14164,7 +14164,13 @@ def __activate_virtual_display(self):
1416414164
backend="xvfb",
1416514165
use_xauth=True,
1416614166
)
14167+
if "--debug-display" in sys.argv:
14168+
print(
14169+
"Starting VDisplay from base_case: (%s, %s)"
14170+
% (self._xvfb_width, self._xvfb_height)
14171+
)
1416714172
self._xvfb_display.start()
14173+
sb_config._virtual_display = self._xvfb_display
1416814174
if "DISPLAY" not in os.environ.keys():
1416914175
print(
1417014176
"\nX11 display failed! Will use regular xvfb!"

seleniumbase/undetected/cdp_driver/cdp_util.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ def __activate_virtual_display_as_needed(
5151
headless, headed, xvfb, xvfb_metrics
5252
):
5353
"""This is only needed on Linux."""
54-
if IS_LINUX and (not headed or xvfb):
54+
if (
55+
IS_LINUX
56+
and (not headed or xvfb)
57+
and (
58+
not hasattr(sb_config, "_virtual_display")
59+
or not sb_config._virtual_display
60+
)
61+
):
5562
from sbvirtualdisplay import Display
5663
pip_find_lock = fasteners.InterProcessLock(
5764
constants.PipInstall.FINDLOCK
@@ -87,6 +94,11 @@ def __activate_virtual_display_as_needed(
8794
backend="xvfb",
8895
use_xauth=True,
8996
)
97+
if "--debug-display" in sys.argv:
98+
print(
99+
"Starting VDisplay from cdp_util: (%s, %s)"
100+
% (_xvfb_width, _xvfb_height)
101+
)
90102
_xvfb_display.start()
91103
if "DISPLAY" not in os.environ.keys():
92104
print(

setup.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
print("You are currently using Python %s\n" % current_ver)
3737
sys.exit()
3838
print("\n*** Checking code health with flake8:\n")
39-
os.system("python -m pip install 'flake8==7.2.0'")
39+
os.system("python -m pip install 'flake8==7.3.0'")
4040
flake8_status = os.system("flake8 --exclude=recordings,temp")
4141
if flake8_status != 0:
4242
print("\nERROR! Fix flake8 issues before publishing to PyPI!\n")
@@ -174,15 +174,15 @@
174174
'parse-type>=0.6.4',
175175
'colorama>=0.4.6',
176176
'pyyaml>=6.0.2',
177-
'pygments>=2.19.1',
177+
'pygments>=2.19.2',
178178
'pyreadline3>=3.5.3;platform_system=="Windows"',
179179
"tabcompleter>=1.4.0",
180180
"pdbp>=1.7.0",
181181
"idna==3.10",
182182
'chardet==5.2.0',
183183
'charset-normalizer>=3.4.2,<4',
184184
'urllib3>=1.26.20,<2;python_version<"3.10"',
185-
'urllib3>=1.26.20,<2.5.0;python_version>="3.10"',
185+
'urllib3>=1.26.20,<2.6.0;python_version>="3.10"',
186186
'requests==2.32.4',
187187
'sniffio==1.3.1',
188188
'h11==0.16.0',
@@ -203,14 +203,14 @@
203203
'pluggy==1.5.0;python_version<"3.9"',
204204
'pluggy==1.6.0;python_version>="3.9"',
205205
'pytest==8.3.5;python_version<"3.9"',
206-
'pytest==8.4.0;python_version>="3.9"',
206+
'pytest==8.4.1;python_version>="3.9"',
207207
"pytest-html==4.0.2", # Newer ones had issues
208208
'pytest-metadata==3.1.1',
209209
"pytest-ordering==0.6",
210210
'pytest-rerunfailures==14.0;python_version<"3.9"',
211211
'pytest-rerunfailures==15.1;python_version>="3.9"',
212212
'pytest-xdist==3.6.1;python_version<"3.9"',
213-
'pytest-xdist==3.7.0;python_version>="3.9"',
213+
'pytest-xdist==3.8.0;python_version>="3.9"',
214214
'parameterized==0.9.0',
215215
"behave==1.2.6",
216216
'soupsieve==2.7',
@@ -242,12 +242,12 @@
242242
# Usage: flake8
243243
"flake8": [
244244
'flake8==5.0.4;python_version<"3.9"',
245-
'flake8==7.2.0;python_version>="3.9"',
245+
'flake8==7.3.0;python_version>="3.9"',
246246
"mccabe==0.7.0",
247247
'pyflakes==2.5.0;python_version<"3.9"',
248-
'pyflakes==3.3.2;python_version>="3.9"',
248+
'pyflakes==3.4.0;python_version>="3.9"',
249249
'pycodestyle==2.9.1;python_version<"3.9"',
250-
'pycodestyle==2.13.0;python_version>="3.9"',
250+
'pycodestyle==2.14.0;python_version>="3.9"',
251251
],
252252
# pip install -e .[ipdb]
253253
# (Not needed for debugging anymore. SeleniumBase now includes "pdbp".)
@@ -275,7 +275,7 @@
275275
# (An optional library for image-processing.)
276276
"pillow": [
277277
'Pillow>=10.4.0;python_version<"3.9"',
278-
'Pillow>=11.2.1;python_version>="3.9"',
278+
'Pillow>=11.3.0;python_version>="3.9"',
279279
],
280280
# pip install -e .[pip-system-certs]
281281
# (If you see [SSL: CERTIFICATE_VERIFY_FAILED], then get this.)

0 commit comments

Comments
 (0)