I have this script to acess my internet modem and reboot the device, but stop to work some weeks ago. Here my code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
service = Service(executable_path=ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
from selenium.webdriver.common.by import By
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options)
driver.get('http://192.168.15.1/me_configuracao_avancada.asp',)
user = driver.find_element(By.ID, "txtUser")
user.send_keys("support")
btnLogin = driver.find_element(By.ID, "btnLogin")
btnLogin.click()
driver.get('http://192.168.15.1/reboot.asp',)
reboot = driver.find_element(By.ID, "btnReboot")
reboot.click()
print("Modem Reiniciado!")
now when i run, this error messages return:
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "modem.py", line 7, in <module>
driver = webdriver.Chrome(service=service)
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
super().__init__(
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 277, in __init__
self.start_session(capabilities, browser_profile)
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
self.error_handler.check_response(response)
File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: 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.)
Stacktrace:
#0 0x561e346d9cd3 <unknown>
#1 0x561e344e1968 <unknown>
#2 0x561e3450625c <unknown>
#3 0x561e345018fa <unknown>
#4 0x561e3453c94a <unknown>
#5 0x561e34536aa3 <unknown>
#6 0x561e3450c3fa <unknown>
#7 0x561e3450d555 <unknown>
#8 0x561e347212bd <unknown>
#9 0x561e34725418 <unknown>
#10 0x561e3470b36e <unknown>
#11 0x561e34726078 <unknown>
#12 0x561e346ffbb0 <unknown>
#13 0x561e34742d58 <unknown>
#14 0x561e34742ed8 <unknown>
#15 0x561e3475ccfd <unknown>
#16 0x7fc22f8b9609 <unknown>
Some weeks ago this code run without any problems, but now i'm stuck I'm using Google Chrome 103.0.5060.134 and ChromeDriver 103.0.5060.134.
CodePudding user response:
This error message...
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
...implies that the requests
module is backdated hence not in sync and needs an update.
Solution
You can update the requests
module using either of the following commands:
pip3 install requests
or
pip3 install --upgrade requests