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

problem with stealth #29

Open
LeaDer-E opened this issue Feb 12, 2022 · 2 comments
Open

problem with stealth #29

LeaDer-E opened this issue Feb 12, 2022 · 2 comments

Comments

@LeaDer-E
Copy link

LeaDer-E commented Feb 12, 2022

i got a problem with the stealth, can i get any help pls? <3

from selenium import webdriver
from selenium_stealth import stealth
import time

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")

# options.add_argument("--headless")

options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=r"/home/eslammustafa/Desktop/PY Projects")

stealth(driver,
        languages=["en-US", "en"],
        vendor="Google Inc.",
        platform="Win32",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

url = "https://bot.sannysoft.com/"
driver.get(url)
time.sleep(5)
driver.quit()

and the problem is:

Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
====== RESTART: /home/eslammustafa/Desktop/PY Projects/selenium-stealth.py =====

Warning (from warnings module):
  File "/home/eslammustafa/Desktop/PY Projects/selenium-stealth.py", line 12
    driver = webdriver.Chrome(options=options, executable_path=r"/home/eslammustafa/Desktop/PY Projects")
DeprecationWarning: executable_path has been deprecated, please pass in a Service object

Warning (from warnings module):
  File "/home/eslammustafa/.local/lib/python3.8/site-packages/requests/__init__.py", line 89
    warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
RequestsDependencyWarning: urllib3 (1.26.8) or chardet (3.0.4) doesn't match a supported version!
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/eslammustafa/Desktop/PY Projects'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode
    exec(code, self.locals)
  File "/home/eslammustafa/Desktop/PY Projects/selenium-stealth.py", line 12, in <module>
    driver = webdriver.Chrome(options=options, executable_path=r"/home/eslammustafa/Desktop/PY Projects")
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chromium/webdriver.py", line 90, in __init__
    self.service.start()
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 86, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'PY Projects' executable may have wrong permissions. Please see https://chromedriver.chromium.org/home

>>> 
@CaptainStabs
Copy link

CaptainStabs commented Feb 14, 2022

I don't think this has anything to do with stealth, try enabling write permissions (chmod a+x <path> iirc).

First error is telling you to provide the binary path as a service.

The way I use selenium is:

PATH = <path to chromedriver>
options = Options()
options.binary_location = <path to chrome binary>
self.driver = webdriver.Chrome(PATH, options=options)

the executable path requires an executable, not a folder.

You should change line 12 to:

driver = webdriver.Chrome("/home/eslammustafa/Desktop/PY Projects/chromedriver", options=options)

(I'm assuming executable_path is for the chromedriver, correct me if I'm wrong)
Add whatever extension the chromedriver file has to the end.

@LeaDer-E
Copy link
Author

Im really thank you 🥰🌹

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

2 participants