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

Fixing Error AttributeError: 'ChromeOptions' object has no attribute 'headless' #1629

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ Automatically downloads the driver binary and patches it.
## Installation ##

```
pip install undetected-chromedriver
```
or , if you're feeling adventurous, install directly via github

```
pip install git+https://www.github.com/ultrafunkamsterdam/undetected-chromedriver@master # replace @master with @branchname for other branches
pip install git+https://www.github.com/medsagou/undetected-chromedriver@master # replace @master with @branchname for other branches
```


Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
dirname = os.path.abspath(os.path.dirname(__file__))

with codecs.open(
os.path.join(dirname, "undetected_chromedriver", "__init__.py"),
os.path.join(dirname, "undetected_chromedriver_modified_sagou", "__init__.py"),
mode="r",
encoding="utf-8",
) as fp:
Expand All @@ -37,16 +37,16 @@
)

setup(
name="undetected-chromedriver",
name="undetected-chromedriver-modified-sagou",
version=version,
packages=["undetected_chromedriver"],
packages=["undetected_chromedriver_modified_sagou"],
install_requires=[
"selenium>=4.9.0",
"requests",
"websockets",
],
package_data={"undetected_chromedriver": [os.path.join("example", "example.py")]},
url="https://github.com/ultrafunkamsterdam/undetected-chromedriver",
package_data={"undetected_chromedriver_modified_sagou": [os.path.join("example", "example.py")]},
url="https://github.com/medsagou/undetected-chromedriver",
license="GPL-3.0",
author="UltrafunkAmsterdam",
author_email="[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Y88b. 888 888 888 Y88..88P 888 888 888 Y8b. Y88b 888 888 888 Y8bd8P Y8b. 888
"Y8888P 888 888 888 "Y88P" 888 888 888 "Y8888 "Y88888 888 888 Y88P "Y8888 888 88888888

by UltrafunkAmsterdam (https://github.com/ultrafunkamsterdam)
by UltrafunkAmsterdam AND MODIFIED BY SAGOU (https://github.com/medsagou)

"""
from __future__ import annotations
Expand Down Expand Up @@ -302,7 +302,7 @@ def __init__(

if any([_ in arg for _ in ("--headless", "headless")]):
options.arguments.remove(arg)
options.headless = True
# options.headless = True

if "lang" in arg:
m = re.search("(?:--)?lang(?:[ =])?(.*)", arg)
Expand Down Expand Up @@ -395,7 +395,7 @@ def __init__(
if no_sandbox:
options.arguments.extend(["--no-sandbox", "--test-type"])

if headless or options.headless:
if headless:
#workaround until a better checking is found
try:
if self.patcher.version_main < 108:
Expand Down Expand Up @@ -485,8 +485,8 @@ def __init__(
else:
self._web_element_cls = WebElement

if options.headless:
self._configure_headless()
# if options.headless:
# self._configure_headless()

def _configure_headless(self):
orig_get = self.get
Expand Down Expand Up @@ -840,7 +840,7 @@ def __del__(self):
self.service.process.kill()
except: # noqa
pass
self.quit()
# self.quit() #Fixing __expection getting ignore error

@classmethod
def _ensure_close(cls, self):
Expand Down