Question: how to download Chrome or another browser to use it as an emulator for web requests.
from selenium.webdriver.common.by import By
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())
driver.get('http://www.yahoo.com')
assert 'Yahoo' in driver.title
elem = driver.find_element(By.NAME, 'p') # Find the search box
elem.send_keys('seleniumhq' + Keys.RETURN)
driver.quit()
Yahoo is just as an example.
Error:
[WDM] - Downloading: 100%|████| 6.83M/6.83M [00:00<00:00, 66.2MB/s]
main.py:102: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())
Traceback (most recent call last):
File "main.py", line 102, in <module>
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())
File "/home/runner/Web-request-01v/venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 80, in __init__
super().__init__(
File "/home/runner/Web-request-01v/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 101, in __init__
self.service.start()
File "/home/runner/Web-request-01v/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 106, in start
self.assert_process_still_running()
File "/home/runner/Web-request-01v/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 119, in assert_process_still_running
raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service /home/runner/.wdm/drivers/chromedriver/linux64/111.0.5563/chromedriver unexpectedly exited. Status code was: 127
I googled and tried some ways to do it, however nothing helped.
I’m not saying that I did everything right, so I will appreciate your help.