Remeraze
Remeraze

Reputation: 21

Chrome closes immediately after being opened with selenium (Python)

I've tried every solution I could find.

I'm trying to open Chrome with selenium for Imgur authentication purposes. here's the code:

def imgur_auth():
     imgur_id = 'NO'
     imgur_secret = 'NO'
     client = ImgurClient(imgur_id, imgur_secret)
     imgur_name = 'NO'
     imgur_password = 'NO'
     imgur_auth_url = client.get_auth_url('pin')
     driver = webdriver.Chrome(executable_path=r'NO\Python\other\chromedriver')
     driver.get(imgur_auth_url)

imgur_auth()

right after Chrome opens and loads the page, it immediately closes.

help?

Upvotes: 0

Views: 182

Answers (1)

Vignesh
Vignesh

Reputation: 1623

as you called driver var inside function it terminates after the execution of function.

try removing the function and run

Upvotes: 1

Related Questions