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

Fix attribute error of options.headless #1602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gaspardruan
Copy link

Env: windows11 + undetected-chromedriver 3.5.3 + selenium 4.13.0 + chrome 117
Problem: When running the given example in readme:

import undetected_chromedriver as uc

driver = uc.Chrome()
driver.get('https://nowsecure.nl')
driver.save_screenshot('nowsecure.png')

I've got:

driver = uc.Chrome()
             ^^^^^^^^^^^
File "C:\Users\Gaspard\anaconda3\envs\Scrapy\Lib\site-packages\undetected_chromedriver\__init__.py", line 398, in __init__
    if headless or options.headless:
                   ^^^^^^^^^^^^^^^^
AttributeError: 'ChromeOptions' object has no attribute 'headless'

Solution
Now that there is little difference between headless and options.headless, it's suggested to use headless only.

@nathan30
Copy link

nathan30 commented Oct 11, 2023

Why not use getattr(options, 'headless', None) instead of removing the options.headless ?

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

Successfully merging this pull request may close these issues.

2 participants