title: Selenium Webdriver Chromedriver timeout on start in headless mode
body: <p>I am using Selenium Webdriver, with Ruby 32-bit 1.9.3, Chromedriver v2.9.248315, Chrome 38.0.2125.111 m and a local instance of Jenkins 1.588</p>
  
  <p>Gems: cucumber (1.3.17), selenium-webdriver (2.43.0), watir-webdriver (0.6.11) (can provide list of all others if you think necessary) </p>
  
  <p>Windows 7 Professional 64-bit edition.</p>
  
  <p>When running a Jenkins job which starts Chrome using chromedriver and then trying to interact with it I get a timeout error. When doing the same on my desktop via a command prompt window it works perfectly. Running the same Jenkins job, starting Firefox instead of Chrome it works perfectly.</p>
  
  <p>Simple example (C:\test.rb):</p>
  
  <pre><code>require 'watir-webdriver'
  require 'selenium-webdriver'
  client = Selenium::WebDriver::Remote::Http::Default.new
  $browser = Watir::Browser.new :chrome, :http_client =&gt; client
  $browser.driver.manage.window.maximize
  $browser.close
  </code></pre>
  
  <p>Jenkins job configured to run Windows Batch Command:</p>
  
  <pre><code>cd \
  ruby test.rb
  </code></pre>
  
  <p>The output when I run the job:</p>
  
  <pre><code>Started by user anonymous
  Building in workspace C:\Program Files (x86)\Jenkins\jobs\test chromedriver\workspace
  [workspace] $ cmd /c call C:\Windows\TEMP\hudson3963234995624341455.bat
  
  C:\Program Files (x86)\Jenkins\jobs\test chromedriver\workspace&gt;cd \ 
  
  C:\&gt;ruby test.rb 
  C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill': Timeout::Error (Timeout::Error)
      from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
      from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
      from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in `request'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in `start'
      from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in `request'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:638:in `raw_execute'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:616:in `execute'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/bridge.rb:236:in `maximizeWindow'
      from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/common/window.rb:98:in `maximize'
      from test.rb:5:in `&lt;main&gt;'
  
  C:\&gt;exit 1 
  Build step 'Execute Windows batch command' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>I have tried enabling "Allow service to interact with desktop" in the Jenkins service, then watching the window (in a more complex scenario) and the Chrome window opens, but does nothing. I originally had the problem with "$browser.cookies.clear" and after commenting out that line I now have the same problem with the line $browser.driver.manage.window.maximize</p>
  
  <p>I was running complex cucumber scenarios with no trouble using Chromedriver. Then I had my PC rebuilt and after installing Jenkins, Ruby, Chromedriver (adding both to PATH) and copying the old jobs into my new Jenkins installation I had the above problem. I then created the simple example above, tested it and created this post.</p>
  
  <p>If anyone has any ideas about how I can get Chromedriver working again that would be great.</p>