I just started to learn Python + selenium.
Here's my setup:
103.0.5046.0
103.0.5046.0
122.0.6261.70
Here's my code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
options.binary_location = r'D:\fewst\Downloads\Win_x64_1000027_chrome-win\chrome-win/chrome.exe'
driver.get("https://www.google.com")
I just want the website to remain open and stay that way at the end of my script.
I don't want the browser to close automatically.
Once the program ends, the process exits and the selenium goes down. Your solution here is to delay the process. For this you could either use input()
, which waits for an input in the terminal, or the time.sleep()
function to run the program for a longer period.
Example:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.binary_location = r'D:\fewst\Downloads\Win_x64_1000027_chrome-win\chrome-win/chrome.exe'
driver = webdriver.Chrome(options=options)
driver.get("https://www.google.com")
input() # dont enter any unless you want to shut it down