/**
  * Returns the unique browser.
  *
  * @return WebDriver\Browser
  */
 public function getBrowser($create = false)
 {
     if ($create) {
         $browser = Browser::create($this->getBrowserName(), $this->getServerUrl());
         $browser->closeOnDestruct();
         return $browser;
     }
     if (null === self::$browser) {
         self::$browser = Browser::create($this->getBrowserName(), $this->getServerUrl());
         self::$browser->closeOnDestruct();
     }
     return self::$browser;
 }
 /**
  * Uploads a file to the selected field.
  *
  * @param string $file Absolute path to the file
  *
  * @return string Path on server.
  */
 public function upload($file)
 {
     $zip = new Zip();
     $zip->addFile($file);
     $response = $this->browser->request('POST', 'file', json_encode(array('file' => base64_encode($zip->getContent()))));
     $content = json_decode($response->getContent(), true);
     if (!isset($content['value'])) {
         throw new LibraryException('Malformed expression, no key "value" in response: ' . $response->getContent());
     }
     $file = $content['value'];
     $this->type($file);
     return $file;
 }