title: Page Object Extension with Behat 3 and Mink 1.5 throws an Exception
body: <p>I've a project running with <code>Behat 2.4</code>, <code>Mink 1.4</code> and <code>Behat Page Object Extension</code>, with this version my tests is fine, 100% passed.</p>
  
  <p>But now i'm migrating to <code>Behat 3</code> due to the fully integration with Browserstack, Behat 2 doesn't support BrowserStack flags and the integration is poor.</p>
  
  <p>I've changed my composer file and I updated project, but when I run the tests, it is  returning an Exception on <code>Page Object Extension</code>.</p>
  
  <pre><code>To create pages you need to pass a factory with setPageObjectFactory() (RuntimeException)
  </code></pre>
  
  <p>Looking at <a href="http://behat-page-object-extension.readthedocs.org/en/latest/guide/working_with_page_objects.html#using-the-page-object-factory" rel="nofollow">Page Object Docs</a> I don't see anything about setPageObjectFatory, this isn't needed.
  In configuration section, only specifies <code>factory</code> if you create a custom factory or/and custom class name resolver.</p>
  
  <p>My composer with all dependencies is </p>
  
  <pre><code>{
      "require-dev" : {
          "behat/behat" : "master-dev",
          "behat/mink-goutte-driver" : "master-dev",
          "behat/mink-browserkit-driver" : "master-dev",
          "sensiolabs/behat-page-object-extension" : "master-dev",
          "behat/mink-extension" : "master-dev",
          "behat/mink-selenium2-driver" : "master-dev",
          "behat/mink" : "master-dev"
      }
  }
  </code></pre>
  
  <p>And my behat.yml bellow</p>
  
  <pre><code>default:
    suites:
      default:
        contexts:
          - FeatureContext
          - ProductDetailsContext
          - CartContext
        extensions:
          SensioLabs\Behat\PageObjectExtension:
            namespaces:
              page: [Features\Page]
              element: [Features\Page\Element]
          Behat\MinkExtension:
            sessions:
              my_session:
                browser_stack:
                  username: my_username
                  access_key: my_password
                  capabilities: 
                    browserName: "Chrome"
                    browserVersion: "35"
                    platform: "WIN8"
  </code></pre>
  
  <p>My FeatureContext extending MinkContext</p>
  
  <pre><code>&lt;?php
  
  use Behat\MinkExtension\Context\MinkContext;
  
  /**
   * Behat context class.
   */
  class FeatureContext extends MinkContext
  {
  }
  </code></pre>
  
  <p>And ProductDetailsContext extending PageObjectContext</p>
  
  <pre><code>&lt;?php
  use SensioLabs\Behat\PageObjectExtension\Context\PageObjectContext;
  
  /**
   *
   *
   */
  class ProductDetailsContext extends PageObjectContext
  {
      /**
       * @Given /^I am on product details "([^"]*)"$/
       *
       * @param string $url
       */
      public function iAmOnProductDetails($url)
      {
          $this-&gt;getPage("ProductDetails")-&gt;open(array("productUrl" =&gt; $url));
      }
  
      /**
       * @Given /^I am at a random product details$/
       */
      public function iAmAtARandomProductDetails()
      {
          $catalog = $this-&gt;getPage("Catalog");
          $catalog-&gt;open(array('category' =&gt; 'calcados-femininos'));
          $catalog-&gt;openRandomProduct();
      }
  
      /**
       * @When /^I select product size$/
       */
      public function iSelectProductSize()
      {
          $this-&gt;getPage("ProductDetails")-&gt;selectProductSize();
      }
  
      /**
       * @Then /^I add product to cart$/
       */
      public function iAddProductToCart() {
          $this-&gt;getPage("ProductDetails")-&gt;addProductToCart();
      }
  
      /**
       * @Then /^I add product to wishlist$/
       */
      public function iAddProductToWishlist()
      {
          $this-&gt;getPage("ProductDetails")-&gt;addProductToWishlist();
      }
  }
  </code></pre>
  
  <p>I don't know how can solve this and I need help.</p>