title: Behat, Selenium2 in new window (Facebook) cookies are disabled
body: <p>I am using Behat3 with Selenium2 (locally).<br>
  Today I want to write a Behat-Test for our Facebook-Login.  </p>
  
  <p>My test looks like this:</p>
  
  <pre class="lang-gherkin prettyprint-override"><code>Background:
     Given I am on the home page
  
  Scenario: Test button in account dropdown
     When I hover the account dropdown
     And I click on ".login .facebook"
     And I wait for 5 seconds
  
     Then there should be 2 open windows
  
  Scenario: Test facebook login
     Given I hovered the account dropdown
     And I click on ".login .facebook"
     And I wait for 5 seconds
  
     When I focus the opened window
     And I fill in the following:
       | email   | facebooklogin@mail.de |
       | pass    | facebookpassword      |
     And I submit the "#login_form" form
  </code></pre>
  
  <p>Everything works fine. Except, that I cannot make a login on the Facebook auth page. Facebook says: <code>Cookies are disabled, please activate cookies to sign in</code>.</p>
  
  <p>So, I added a "I wait for 60 seconds" at the end of my scenario and I had checked the browser-settings. I expected, that the option "Allow cookies" is disabled. But it's <strong>enabled</strong>! </p>
  
  <p>Here is my question:<br>
  Is there a way, to tell selenium, that cookies should be enabled in the new window or why said Facebook that cookies are disabled, although they are enabled?</p>
  
  <p>To open the new window, I try something like that:</p>
  
  <pre class="lang-php prettyprint-override"><code>$windows = $this-&gt;getSession()-&gt;getDriver()-&gt;getWindowNames();
  $windowName = $windows[count($windows)-1];
  $this-&gt;getSession()-&gt;getDriver()-&gt;switchToWindow($windowName);
  </code></pre>
  
  <p>But I have also tried something like <code>getSession(sessionName)-&gt;switchToWindow</code> and some more possibilities...</p>
  
  <p>Can anyone help?</p>
  
  <p>Regards, Tim</p>