Selenium hangs when starting chrome with chromedriver and Xvfb

82 views
Skip to first unread message

Trevor Haba

unread,
Feb 17, 2015, 5:30:06 PM2/17/15
to webd...@googlegroups.com
I am creating an app that continuously opens a page in chrome and then takes a screenshot. It does this once every 30 seconds. It is running on EC2 with an Xvfb instance using xvfbwrapper: (https://github.com/cgoldberg/xvfbwrapper). The program works fine when running on my personal computer, and it works fine at first when running on EC2. However, when it is left to run for several hours, it eventually ends up hanging indefinitely. Here is the relevant pieces of code:

I am using: ChromeDriver 2.14.313457
Google Chrome 40.0.2214.111
Selenium 2.42.1

While true:
    xvfb = Xvfb(width=1920, height=1920)
    xvfb.xvfb_cmd.append('-noreset')
    log("starting Xvfb: " , xvfb.xvfb_cmd)
    xvfb.start()

    try:
        options = Options()        
        options.add_argument("--disable-web-security")
        options.add_argument("--webdriver-logfile=webdrive.log")
        dc = DesiredCapabilities.CHROME
        dc['loggingPrefs'] = {'browser': 'ALL'}
        log("preferences set, attempting to start driver")
        driver = webdriver.Chrome(chrome_options=options, desired_capabilities=dc)
        log("driver started, attempting to load page")
        driver.get(url);
                 log('loaded the page')
        data = driver.get_screenshot_as_base64()
     
        driver.quit()
        xvfb.stop()

From the log files, I see up until `preferences set, attempting to start driver` and then nothing, for many hours, until I manually restart the program. Then it starts working fine again. It appears that the call to `webdriver.Chrome(...)` never returns, and never throws an error either. The program is just indefinitely waiting. 

I have looked for out of memory exceptions following the post here: https://unix.stackexchange.com/questions/128642/debug-out-of-memory-with-var-log-messages and nothing presents itself. 

How can I continue to debug this? Is there a way to see more detailed log messages from selenium? Or from chromedriver? 
Reply all
Reply to author
Forward
0 new messages