I'm trying to keep my automated chrome windows open, but they close with this error:
Traceback (most recent call last):
File "C:\Users\Duma\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 841, in __del__
self._internal_poll(_deadstate=_maxsize)
File "C:\Users\Duma\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1193, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid
Using Selenium and my Python script looks like this:
login_url='https://www.life4laptop.com/index.php?route=account/login'
url='https://www.life4laptop.com/index.php?route=product/search&search=samsung'
list=[]
driver=webdriver.Chrome(crm_path, chrome_options=options)
driver.get(login_url)
elem = driver.find_element_by_id("input-email")
elem.clear()
elem.send_keys(x['life4laptop']['username'])
elem = driver.find_element_by_id("input-password")
elem.clear()
elem.send_keys(x['life4laptop']['password'])
elem = driver.find_element_by_xpath("//form/input[@type='submit']")
elem.click()
driver.get(url)
driver2=webdriver.Chrome(crm_path, chrome_options=options)
driver2.get(login_url)
elem = driver2.find_element_by_id("input-email")
elem.clear()
elem.send_keys(x['life4laptop']['username'])
elem = driver2.find_element_by_id("input-password")
elem.clear()
elem.send_keys(x['life4laptop']['password'])
elem = driver2.find_element_by_xpath("//form/input[@type='submit']")
elem.click()
driver2.get(url)
#driver.close()
#driver.quit()
Any clues why, and how to get it working?
It might have been because I quit my script. When the script is contentiously running, it's fine.