Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

WebDriver 'driver.quit()' command does not work in my setup #1325

Closed
lukeis opened this issue Mar 2, 2016 · 12 comments
Closed

WebDriver 'driver.quit()' command does not work in my setup #1325

lukeis opened this issue Mar 2, 2016 · 12 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 1325

What steps will reproduce the problem?
1. Create a Firefox profile and verify that you can restart Firefox without errors

Create STEELE profile:
firefox -no-remote -P
Add STEELE profile and close Firefox
firefox -P STEELE -no-remote
Firefox --> Edit --> Preferences
Advanced --> Encryption --> View Certificates 
Servers --> Import --> Import --> <our crt files -> Open --> OK --> Close

Install Add-Ons:
Firefox --> Tools --> Add-ons
Add FireBug --> Install Now
Add Selenium IDE
    http://seleniumhq.org
    Download Selenium
    Download Selenium IDE v1.0.10 (or the most recent version)

Set FIrefox Edit --> Preferences:
Privacy --> Select ‘Use custom settings’ --> De-select ‘Remember search and form history’
--> Close
Close Firefox

profile = FirefoxProfile("STEELE")
driver = webdriver.Firefox(profile=profile)
Close Add-ons pop-up

Restart Firefox
Verify no errors on the command-line
Close Firefox

2. Bring up Python and do your imports, then launch the browser:

python
import time
import unittest
import shutil
import os
import re
import unittest
import tempfile
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.exceptions import NoSuchElementException
from selenium.webdriver.common.exceptions import NoSuchFrameException

profile = FirefoxProfile("STEELE")
driver = webdriver.Firefox(profile=profile)
driver.get("https://172.16.109.225/service")

3. Now try closing this session with the WebDriver cmd "driver.quit()" and you'll see
the following error... quit out of Python

driver.quit()
!!! error running onStopped callback: TypeError: callback is not a function
Try to reconnect to 'driver.get("https://172.16.109.225/service")' and get you get
a stacktrace
quit()

4. Now try bringing up  Firefox outside of Python/WebDriver, then close Firefox and
you see the same error now on the command-line

profile = FirefoxProfile("STEELE")
Close Firefox
!!! error running onStopped callback: TypeError: callback is not a function



What is the expected output? What do you see instead?
Using driver.quit() seems to corrupt my Firefox profile.


What version of the product are you using? On what operating system?
Ubuntu Lucid 10.04 64-bit (172.16.110.120)
WebDriver 2.0b2 (trunk 11502. from 02/21/11)
Python 2.6.5
Firefox 3.6.13
Firebug 1.6.2
Selenium IDE 1.0.10

Please provide any additional information below.
I have successfully used driver.quit() in the past couple weeks, so I'm not sure what
has changed recently other than that I am using Firebug and Selenium IDE as add-ons.

Reported by cathy.pedersen on 2011-02-22 01:55:32

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I just tried setting up a Firefox profile with no add-ons and I still see this error.
So that's not the problem.

Reported by cathy.pedersen on 2011-02-22 02:21:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

All you need to do to get this error is 

from selenium import webdriver
br = webdriver.Firefox()
br.close()
>>> !!! error running onStopped callback: TypeError: callback is not a function

Lots of people are getting this (google and you'll find the references), many are using
64bit ubuntu but I'm getting it on 32bit osx 10.6. 

This goes back as far as 21/7/10 http://comments.gmane.org/gmane.comp.web.selenium.devel/4635

Reported by random35743373 on 2011-03-08 08:38:31

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I have:

- mac osx 10.6.6
- python 2.7.1
- selenium - Revision 11706: /trunk

and get the same error when doing:

>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
>>> driver.get('http://www.google.com')
>>> driver.quit()
>>> !!! error running onStopped callback: TypeError: callback is not a function

After running driver.quit(), firefox browser quitted, but left two zombie processes
'(firefox-bin)'.

 ~$ ps auxww | grep firefox
monogeo 11748   0.0  0.0        0      0 s000  Z+   11:33PM   0:00.00 (firefox-bin)
monogeo 11753   0.0  0.0  2435120    536 s002  R+   11:34PM   0:00.00 grep firefox
monogeo 11750   0.0  0.0        0      0 s000  Z+   11:33PM   0:00.00 (firefox-bin)

I just started learning selenium 2, and any help is greatly appreciated! 

In short, what should I try in order to make driver.quit() run properly without reporting
the error and without leaving zombie processes. 

Thanks much!


Reported by monogeo on 2011-03-19 06:41:32

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Just noticed I forgot to mention my firefox version, and here you go:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303
Firefox/3.6.15

Reported by monogeo on 2011-03-19 06:45:00

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by theautomatedtester on 2011-03-19 20:05:52

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by theautomatedtester on 2011-03-19 20:07:37

  • Status changed: Started
  • Labels added: Lang-Python

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

fixed in r11726

Reported by theautomatedtester on 2011-03-21 14:08:20

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Thank you for the prompt fix. I updated the trunk to revision 11726 and successfully
ran 'sudo ./go py_install'. However, I got these debugging logs:

>>> from selenium import webdriver
>>> from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
>>> profile = FirefoxProfile('selenium')
>>> driver = webdriver.Firefox(profile=profile)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'profile'
>>> driver = webdriver.Firefox()
*** EM_LOG *** Item Installed via directory addition to Install Location: app-global
Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd}, attempting to register...
*** EM_LOG *** Item Installed/Upgraded at Install Location: app-global Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd},
attempting to register...
*** EM_LOG *** ... success, item is compatible
*** EM_LOG *** Item Installed via directory addition to Install Location: app-profile
Item ID: fxdriver@googlecode.com, attempting to register...
*** EM_LOG *** Item Installed/Upgraded at Install Location: app-profile Item ID: fxdriver@googlecode.com,
attempting to register...
*** EM_LOG *** ... success, item is compatible
>>> driver.get('http://www.google.com')
>>> driver.quit()
>>>

Although I am no longer getting 'error running onStopped callback: TypeError: callback
is not a function' when doing driver.quit(), I noticed the command is still leaving
(firefox-bin) zombie process.

Is this expected when the python shell is still active (i.e., still running)?

BTW, I tried the latest trunk revision 11758, and got the same behavior.

How do I suppress the debugging logs?

Also, on revision 11706, I could start webdriver with a specific firefox profile this
way:

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
profile = FirefoxProfile('selenium')
driver = webdriver.Firefox(profile=profile)

But now, on 11726 or later, it no longer takes profile as argument. When I tried:

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
profile = FirefoxProfile('selenium')
driver = webdriver.Firefox(fx_profile=profile)

it launched the firefox profile manager.

What is the proper way for specifying the firefox profile nowadays?

Thank you and selenium 2 is awesome!

Reported by monogeo on 2011-03-22 07:46:16

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

fixed the console messages in r11762

raise issue 1435 about the named profile bug. you can create one programmatically and
then use it. Star it so you can see when it is updated and fixed.

profile = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_profile=profile)

Re: Zombie processes, they are harmless. Its up to the Python to clean that up, not
my code as I follow the recommended wait of killing a process. The Kernel will eventually
take them and clean them up

Reported by theautomatedtester on 2011-03-22 10:47:12

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Very cool, thank you, much appreciated!

Reported by monogeo on 2011-03-22 15:01:56

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

When im using driver.quit();
 at the time of execution it is showing...
Aug 28, 2015 3:53:49 PM org.openqa.selenium.os.ProcessUtils killWinProcess
WARNING: Process refused to die after 10 seconds, and couldn't taskkill it
java.lang.RuntimeException: exec return code -1073741515: 
    at org.openqa.selenium.os.WindowsUtils.killPID(WindowsUtils.java:179)
    at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:138)
    at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81)
    at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247)
    at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$2(UnixProcess.java:246)
    at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125)
    at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:153)
    at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:190)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
    at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:464)
    at javaconcepts.Basic.main(Basic.java:34)

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'cithydxp0030', ip: '10.30.2.31', os.name: 'Windows XP', os.arch:
'x86', os.version: '5.1', java.version: '1.7.0_75'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
    at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:464)
    at javaconcepts.Basic.main(Basic.java:34)
Caused by: java.lang.RuntimeException: Process refused to die after 10 seconds, and
couldn't taskkill it: exec return code -1073741515: 
    at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:142)
    at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81)
    at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247)
    at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$2(UnixProcess.java:246)
    at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125)
    at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:153)
    at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:190)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
    ... 3 more
Caused by: java.lang.RuntimeException: exec return code -1073741515: 
    at org.openqa.selenium.os.WindowsUtils.killPID(WindowsUtils.java:179)
    at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:138)
    ... 11 more


Reported by sivakumar.koppuravuri on 2015-08-28 10:18:52

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:12:02

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant