Sto provando a maximizzare la page di chrome all'avvio del programma ma non va. Il progamma parte, apre la scheda e poi si richiude subito
non capisco il perchè. Come errore da
Codice:
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--start-maximized")
Chrome = webdriver.Chrome(chrome_options=chrome_options)
driver = webdriver.Chrome("C:\\Users\\mcara\\PycharmProjects\\test\\drivers\\chromedriver.exe")
driver.set_page_load_timeout(5)
driver.get("https://www.instagram.com/")
Codice:
Traceback (most recent call last):
File "C:\Users\mcara\AppData\Local\Programs\Python\Python36\lib\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\mcara\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\mcara\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 992, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/mcara/PycharmProjects/instagram/instagram/instagram.py", line 8, in <module>
Chrome = webdriver.Chrome(chrome_options=chrome_options)
File "C:\Users\mcara\AppData\Local\Programs\Python\Python36\lib\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
self.service.start()
File "C:\Users\mcara\AppData\Local\Programs\Python\Python36\lib\selenium\webdriver\common\service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1