Skip to content
\n

Here is the error I got

\n

Exception Traceback (most recent call last)
\n in <cell line: 175>()
\n173 make_requests(path, s)
\n174
\n--> 175 main()
\n176
\n177

\n

5 frames
\n in main()
\n169 path = get_path()
\n170 print('Started!')
\n--> 171 test(path)
\n172 s = requests.Session()
\n173 make_requests(path, s)

\n

in test(path)
\n39 if detect_cf(sb):
\n40 print('cloudflare detected!')
\n---> 41 sb.uc_gui_handle_cf()
\n42
\n43 else:

\n

/usr/local/lib/python3.10/dist-packages/seleniumbase/core/browser_launcher.py in (*args, **kwargs)
\n4331 )
\n4332 driver.uc_gui_handle_cf = (
\n-> 4333 lambda *args, **kwargs: uc_gui_handle_cf(
\n4334 driver, *args, **kwargs
\n4335 )

\n

/usr/local/lib/python3.10/dist-packages/seleniumbase/core/browser_launcher.py in uc_gui_handle_cf(driver, frame)
\n906 if not _on_a_cf_turnstile_page(driver):
\n907 return
\n--> 908 install_pyautogui_if_missing(driver)
\n909 import pyautogui
\n910 pyautogui = get_configured_pyautogui(pyautogui)

\n

/usr/local/lib/python3.10/dist-packages/seleniumbase/core/browser_launcher.py in install_pyautogui_if_missing(driver)
\n565
\n566 def install_pyautogui_if_missing(driver):
\n--> 567 verify_pyautogui_has_a_headed_browser(driver)
\n568 pip_find_lock = fasteners.InterProcessLock(
\n569 constants.PipInstall.FINDLOCK

\n

/usr/local/lib/python3.10/dist-packages/seleniumbase/core/browser_launcher.py in verify_pyautogui_has_a_headed_browser(driver)
\n559 focus on the correct element when performing actions.\"\"\"
\n560 if hasattr(driver, \"_is_hidden\") and driver._is_hidden:
\n--> 561 raise Exception(
\n562 \"PyAutoGUI can't be used in headless mode!\"
\n563 )

\n

Exception: PyAutoGUI can't be used in headless mode!

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

That's why it says: Exception: PyAutoGUI can't be used in headless mode!

\n

Don't use UC Mode with Headless Mode.

","upvoteCount":1,"url":"https://github.com/seleniumbase/SeleniumBase/discussions/2932#discussioncomment-10064354"}}}
Discussion options

You must be logged in to vote

That's why it says: Exception: PyAutoGUI can't be used in headless mode!

Don't use UC Mode with Headless Mode.

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
8 replies
@mdmintz
Comment options

@misterpeople
Comment options

@mdmintz
Comment options

@Code-With-Hashim
Comment options

@mdmintz
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
5 replies
@mdmintz
Comment options

@TyronMYoung11
Comment options

@mdmintz
Comment options

@TyronMYoung11
Comment options

@TyronMYoung11
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants