Selenium Chromedriver hanging?

I have a long python application that will periodically (every 30-60 seconds) open a web page using the selenium and chrome driver, run javascript and take a screenshot. Running it on an EC2 ubuntu instance with chrome in Xvfb and for the most part everything works, except for an intermittent program. This happens on one of the following lines:

options = Options() options.add_argument("--disable-web-security") options.add_argument("--webdriver-logfile=webdrive.log") dc = DesiredCapabilities.CHROME dc['loggingPrefs'] = {'browser': 'ALL'} driver = webdriver.Chrome(chrome_options=options, desired_capabilities=dc) driver.get(url); 

(I do not have the exact line, but I know from the debugging instructions that I put in that it is somewhere in the middle)

Unfortunately, the program does not crash, so it does not have error messages, it is just waiting endlessly from 7 pm last night. Running strace -p 'python program pid' returns: wait4(-1, and running strace -p 'chromedriver pid' returns recvfrom(20,

In ps axjf I see that the process is still running, it just doesn't do anything. I do not seem to understand what to do now, any suggestions?

version for chrome rib: 2.10.267518

Google Chrome 40.0.2214.111

Selenium (installed with pip): 2.42.1

 #https://github.com/cgoldberg/xvfbwrapper xvfb = Xvfb(width=1920, height=1920) xvfb.start() 

---- EDIT ----

I just upgraded to ChromeDriver 2.14.313457 and Selenium 2.44.0 , hope this Selenium 2.44.0 problem. For now, I will leave it open. Thanks for the advice so far guys!

---- EDIT ----

So the service was still hanging. I am wondering if this is because for each screenshot I close and restart google-chrome? Perhaps this caused a memory leak? How can I diagnose this?

+7
python selenium selenium-chromedriver
source share
2 answers

I never found a specific piece of code that caused this problem, but creating a new Xvfb instance with every driver load seemed to fix it. Perhaps there is a memory leak somewhere in the interaction between selenium and xvfb? In any case, marking this as closed.

+1
source share

I ran into a similar problem and found the answer here and wrote about it on the blog. Setting the environment variable DBUS_SESSION_BUS_ADDRESS = / dev / null worked for me without having to restart Xvfb all the time.

+6
source share

All Articles