Я хочу запустить свой селен и использовать этот профиль не с нуля!
вот мой код:
Код: Выделить всё
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--user-data-dir=/home/sajjad/.config/google-chrome")
options.add_argument('--profile-directory=Default')
driver = webdriver.Chrome(options=options)
driver.get("https://google.com/")
print(driver.current_url)
Код: Выделить всё
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Код: Выделить всё
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
options = Options()
options.add_argument("--user-data-dir=/home/sajjad/.config/google-chrome")
options.add_argument('--profile-directory=Default')
driver = webdriver.Chrome(options=options,service=Service(executable_path="/opt/google/chrome/chrome"))
driver.get("https://google.com/")
print(driver.current_url)
Код: Выделить всё
Traceback (most recent call last):
File "/home/lab/python/sample.py", line 69, in
driver = webdriver.Chrome(options=options,service=Service(executable_path="/opt/google/chrome/chrome"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
super().__init__(
File "/usr/local/lib/python3.11/dist-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
self.service.start()
File "/usr/local/lib/python3.11/dist-packages/selenium/webdriver/common/service.py", line 109, in start
raise WebDriverException(f"Can not connect to the Service {self._path}")
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /opt/google/chrome/chrome
Подробнее здесь: https://stackoverflow.com/questions/782 ... sing-pyhon