Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless=True does not work #2030

Open
Ambassador-of-programming opened this issue Sep 25, 2024 · 4 comments
Open

Headless=True does not work #2030

Ambassador-of-programming opened this issue Sep 25, 2024 · 4 comments

Comments

@Ambassador-of-programming
Copy link

Ambassador-of-programming commented Sep 25, 2024

Google Chrome version 129.0.6668.71
undetected-chromedriver version 3.5.5

from undetected_chromedriver import By
from fake_useragent import UserAgent
import undetected_chromedriver as uc
from bs4 import BeautifulSoup
import time
import urllib.parse
from parsing.modules.csv import append_to_csv


class Cian:
    def __init__(self):
        self.user_agent = UserAgent().chrome
        self.options_chrome = uc.ChromeOptions()
        self.options_chrome.add_argument(f'user-agent={self.user_agent}')

        self.driver = uc.Chrome(headless=True, use_subprocess=False, 
            options=self.options_chrome, version_main=129,)

the error is this:

(Session info: chrome=129.0.6668.71); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception

Stacktrace:
GetHandleVerifier [0x00B86AB3+25587]
(No symbol) [0x00B19C54]
(No symbol) [0x00A12113]
(No symbol) [0x00A56F62]
(No symbol) [0x00A571AB]
(No symbol) [0x00A97852]
(No symbol) [0x00A7ABE4]
(No symbol) [0x00A95370]
(No symbol) [0x00A7A936]
(No symbol) [0x00A4BA73]
(No symbol) [0x00A4C4CD]
GetHandleVerifier [0x00E64C63+3032483]
GetHandleVerifier [0x00EB6B99+3368153]
GetHandleVerifier [0x00C18F62+624802]
GetHandleVerifier [0x00C207DC+655644]
(No symbol) [0x00B2260D]
(No symbol) [0x00B1F6D8]
(No symbol) [0x00B1F875]
(No symbol) [0x00B11CA6]
BaseThreadInitThunk [0x76E37BA9+25]
RtlInitializeExceptionChain [0x77D7C11B+107]
RtlClearBits [0x77D7C09F+191]

Снимок экрана 2024-09-25 152205

@MichaelMarcelKZ
Copy link

MichaelMarcelKZ commented Sep 25, 2024

Same problem here, but this is not a problem in undetected-chromedriver, but in chrome itself, after it has updated to version 129.

I found something about in here: https://issues.chromium.org/issues/367755364#comment2

They said that won't fix (probably not in 129).

Some things you can try:

You can find more information here: https://stackoverflow.com/questions/78996364/chrome-129-headless-shows-blank-window

@Maxhem2
Copy link

Maxhem2 commented Sep 27, 2024

https://googlechromelabs.github.io/chrome-for-testing/#beta

        browser_executable_path = './chrome-win64/chrome.exe'

        driver = uc.Chrome(options=options, browser_executable_path=browser_executable_path)

@Ambassador-of-programming
Copy link
Author

Ambassador-of-programming commented Sep 28, 2024

https://googlechromelabs.github.io/chrome-for-testing/#beta

        browser_executable_path = './chrome-win64/chrome.exe'

        driver = uc.Chrome(options=options, browser_executable_path=browser_executable_path)

I tried installing https://googlechromelabs.github.io/chrome-for-testing/#beta

and set headless=True, but it doesn't work and gives an error, but if I set False, everything works successfully.

class Cian:
    def __init__(self):
        self.user_agent = UserAgent().chrome
        self.options_chrome = uc.ChromeOptions()
        self.options_chrome.add_argument(f'user-agent={self.user_agent}')

        self.driver = uc.Chrome(
            browser_executable_path='chrome/chrome-win64/chrome.exe',
            driver_executable_path='chrome/chromedriver-win64/chromedriver.exe',
            headless=True
            )


I noticed that the site uses a defense. When headless=True is enabled it doesn't give the html page but only when False is disabled it gives the result. How can this problem be solved?

@unitoew
Copy link

unitoew commented Oct 21, 2024

this works for me

options.add_argument("--headless=new")
options.add_argument("--window-position=-2400,-2400")

I think this issue may be related with selenium and chrome 129.
Like links below same issues have been uploaded on selenium issues.
SeleniumHQ/selenium#14550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants