Chrome opens website and Immediately Closes when Using Selenium and Python
Question:
Chrome Version : 110.0.5481.104
Chrome Driver Version: 110.0.5481.77
From What I have heard last digits of the version do not matter.
Its just a Simple Piece of Code:-
from selenium import webdriver
import os
os.environ['PATH'] =r"C:/Users/xxxx/Desktop/xxxx/Selenium/chromedriver_win32/chromedriver.exe"
driver=webdriver.Chrome()
driver.get("https://phptravels.com/demo/")
Chrome Opens up shows the Website and then Immediately Closes. If the Version is the issue, please inform from which version I should be Downloading as there is no version which ends with 104.
Also something that Might be Worth mentioning…VS Code is Showing me a weird error in the terminal:
USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Thanks Your Help will be appreciated.
Answers:
Your program is ended at line 5, and so did selenium.
Try adding an input()
at the end so the program will wait for user input before exiting.
Better:
# It doesn't wait for user input but
# will close on Ctrl+C
while True:
try:
time.sleep(1);
except KeyboardInterrupt:
break;
Chrome Version : 110.0.5481.104
Chrome Driver Version: 110.0.5481.77
From What I have heard last digits of the version do not matter.
Its just a Simple Piece of Code:-
from selenium import webdriver
import os
os.environ['PATH'] =r"C:/Users/xxxx/Desktop/xxxx/Selenium/chromedriver_win32/chromedriver.exe"
driver=webdriver.Chrome()
driver.get("https://phptravels.com/demo/")
Chrome Opens up shows the Website and then Immediately Closes. If the Version is the issue, please inform from which version I should be Downloading as there is no version which ends with 104.
Also something that Might be Worth mentioning…VS Code is Showing me a weird error in the terminal:
USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Thanks Your Help will be appreciated.
Your program is ended at line 5, and so did selenium.
Try adding an input()
at the end so the program will wait for user input before exiting.
Better:
# It doesn't wait for user input but
# will close on Ctrl+C
while True:
try:
time.sleep(1);
except KeyboardInterrupt:
break;