I have a simple Python script which uses selenium and webdriver to open up Facebook in a Chrome window and log in automatically. When I run it, the Chromedriver console win
I had the same problem, but when I run driver.service.stop() it closes Chrome. I worked around it by importing os and firing off a task kill to the chrome process.
This is another option: first change script extension from .py to .pyw, then:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
driver = webdriver.Chrome(executable_path='C:/apps/chromedriver.exe', service_args=["--verbose", '--log-path=c:/logs/logs/qc1.log'])
driver.get("https://example.com")
switch = driver.find_element_by_id("signInSbmtBtn")
password = driver.find_element_by_id("password")
username = driver.find_element_by_id("userid")
username.send_keys('user');
password.send_keys('password');
switch.click();
os.system("taskkill /im chromedriver.exe")