Browser closes automatically after the tests without calling quit or close ()

6,248 views
Skip to first unread message

Satish

unread,
Nov 16, 2018, 12:14:13 AM11/16/18
to Selenium Users
I'm trying to automate selenium with python on windows 7. Browser - Chrome.

It is strange that my browser automatically closes after the test . I don't have quit() or close()  in my code.

Can someone advise on this?

Sai Krishna Pulivarthi

unread,
Nov 16, 2018, 12:35:03 AM11/16/18
to seleniu...@googlegroups.com
Hi,

The Chrome driver will stop its service once the test ends.

To stop it from happening, you can use the below code. 

from selenium.webdriver import ChromeOptions, Chrome
opts = ChromeOptions()
opts.add_experimental_option("detach", True)
driver = Chrome(chrome_options=opts)

Thanks.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ff1604e0-f625-476b-9c25-88c4cbdbf9e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Satish

unread,
Nov 16, 2018, 2:01:30 AM11/16/18
to Selenium Users
Hey Sai,

That worked but my tests won't run any more due to below error . Is it some compatibility issue with driver and browser? It was running earlier .

selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
  (Session info: chrome=70.0.3538.102)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64)


Rhicha Satam

unread,
Nov 16, 2018, 5:13:13 AM11/16/18
to seleniu...@googlegroups.com
Hi, 
Check whether you have given sufficient wait time in code.. 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Sai Krishna Pulivarthi

unread,
Nov 16, 2018, 5:15:33 AM11/16/18
to seleniu...@googlegroups.com
Yes, I am thinking it will be a compatibility issue, please try to update the driver and the browser to latest version and see if that helps.

Thanks.

Satish

unread,
Nov 17, 2018, 1:31:14 AM11/17/18
to Selenium Users
Tried that and still the same.

How to resolve this?

Venu G

unread,
Nov 21, 2018, 5:51:37 AM11/21/18
to Selenium Users
I have also tried the same but with win10 machine,
In my code i have commented driver.quit to check this, after the completion of test still the test is in running mode until i press terminate button(red button in console) which closes the browser automatically.
Do you have any code like driver.stop_Client() it will also try to close the session i believe. 
Reply all
Reply to author
Forward
0 new messages