You are here

class Browser in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/gastonjs/src/Browser/Browser.php \Zumba\GastonJS\Browser\Browser

Class Browser @package Zumba\GastonJS

Hierarchy

Expanded class hierarchy of Browser

1 file declares its use of Browser
BasePhantomJSDriver.php in vendor/jcalderonzumba/mink-phantomjs-driver/src/BasePhantomJSDriver.php
6 string references to 'Browser'
AssertContentTrait::parse in core/modules/simpletest/src/AssertContentTrait.php
Parse content returned from curlExec using DOM and SimpleXML.
CommentPagerTest::clickLinkWithXPath in core/modules/comment/src/Tests/CommentPagerTest.php
Follows a link found at a give xpath query.
ImageFieldWidgetTest::testWidgetElement in core/modules/image/src/Tests/ImageFieldWidgetTest.php
Tests file widget element.
WebTestBase::clickLinkHelper in core/modules/simpletest/src/WebTestBase.php
Provides a helper for ::clickLink() and ::clickLinkPartialName().
WebTestBase::curlExec in core/modules/simpletest/src/WebTestBase.php
Initializes and executes a cURL request.

... See full list

File

vendor/jcalderonzumba/gastonjs/src/Browser/Browser.php, line 9

Namespace

Zumba\GastonJS\Browser
View source
class Browser extends BrowserBase {
  use BrowserAuthenticationTrait;
  use BrowserConfigurationTrait;
  use BrowserCookieTrait;
  use BrowserFileTrait;
  use BrowserFrameTrait;
  use BrowserHeadersTrait;
  use BrowserMouseEventTrait;
  use BrowserNavigateTrait;
  use BrowserNetworkTrait;
  use BrowserPageElementTrait;
  use BrowserPageTrait;
  use BrowserRenderTrait;
  use BrowserScriptTrait;
  use BrowserWindowTrait;

  /**
   * @param string $phantomJSHost
   * @param mixed  $logger
   */
  public function __construct($phantomJSHost, $logger = null) {
    $this->phantomJSHost = $phantomJSHost;
    $this->logger = $logger;
    $this->debug = false;
    $this
      ->createApiClient();
  }

  /**
   * Returns the value of a given element in a page
   * @param $pageId
   * @param $elementId
   * @return mixed
   */
  public function value($pageId, $elementId) {
    return $this
      ->command('value', $pageId, $elementId);
  }

  /**
   * Sets a value to a given element in a given page
   * @param $pageId
   * @param $elementId
   * @param $value
   * @return mixed
   */
  public function set($pageId, $elementId, $value) {
    return $this
      ->command('set', $pageId, $elementId, $value);
  }

  /**
   * Tells whether an element on a page is visible or not
   * @param $pageId
   * @param $elementId
   * @return bool
   */
  public function isVisible($pageId, $elementId) {
    return $this
      ->command('visible', $pageId, $elementId);
  }

  /**
   * @param $pageId
   * @param $elementId
   * @return bool
   */
  public function isDisabled($pageId, $elementId) {
    return $this
      ->command('disabled', $pageId, $elementId);
  }

  /**
   * Drag an element to a another in a given page
   * @param $pageId
   * @param $fromId
   * @param $toId
   * @return mixed
   */
  public function drag($pageId, $fromId, $toId) {
    return $this
      ->command('drag', $pageId, $fromId, $toId);
  }

  /**
   * Selects a value in the given element and page
   * @param $pageId
   * @param $elementId
   * @param $value
   * @return mixed
   */
  public function select($pageId, $elementId, $value) {
    return $this
      ->command('select', $pageId, $elementId, $value);
  }

  /**
   * Triggers an event to a given element on the given page
   * @param $pageId
   * @param $elementId
   * @param $event
   * @return mixed
   */
  public function trigger($pageId, $elementId, $event) {
    return $this
      ->command('trigger', $pageId, $elementId, $event);
  }

  /**
   * TODO: not sure what this does, needs to do normalizeKeys
   * @param int   $pageId
   * @param int   $elementId
   * @param array $keys
   * @return mixed
   */
  public function sendKeys($pageId, $elementId, $keys) {
    return $this
      ->command('send_keys', $pageId, $elementId, $this
      ->normalizeKeys($keys));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Browser::drag public function Drag an element to a another in a given page
Browser::isDisabled public function
Browser::isVisible public function Tells whether an element on a page is visible or not Overrides BrowserPageElementTrait::isVisible
Browser::select public function Selects a value in the given element and page
Browser::sendKeys public function TODO: not sure what this does, needs to do normalizeKeys
Browser::set public function Sets a value to a given element in a given page
Browser::trigger public function Triggers an event to a given element on the given page
Browser::value public function Returns the value of a given element in a page
Browser::__construct public function
BrowserAuthenticationTrait::setHttpAuth public function Sets basic HTTP authentication
BrowserBase::$apiClient protected property @var Client
BrowserBase::$debug protected property @var bool
BrowserBase::$logger protected property @var mixed
BrowserBase::$phantomJSHost protected property @var string
BrowserBase::command public function Sends a command to the browser
BrowserBase::createApiClient protected function Creates an http client to consume the phantomjs API
BrowserBase::getApiClient public function
BrowserBase::getErrorClass protected function
BrowserBase::getLogger public function
BrowserBase::getPhantomJSHost public function
BrowserBase::normalizeKeys protected function TODO: not sure how to do the normalizeKeys stuff fix when needed
BrowserBase::restart public function Restarts the browser
BrowserConfigurationTrait::debug public function Set the debug mode on the browser
BrowserConfigurationTrait::jsErrors public function Set whether to fail or not on javascript errors found on the page
BrowserConfigurationTrait::urlBlacklist public function Set a blacklist of urls that we are not supposed to load
BrowserCookieTrait::clearCookies public function Clear all the cookies
BrowserCookieTrait::cookies public function Gets the cookies on the browser
BrowserCookieTrait::cookiesEnabled public function Enables or disables the cookies con phantomjs
BrowserCookieTrait::removeCookie public function Deletes a cookie on the browser if exists
BrowserCookieTrait::setCookie public function Sets a cookie on the browser, expires times is set in seconds
BrowserFileTrait::selectFile public function Selects a file to send to the browser to a given page
BrowserFrameTrait::popFrame public function Back to the parent of the iframe if possible
BrowserFrameTrait::pushFrame public function Goes into the iframe to do stuff
BrowserHeadersTrait::addHeader public function Adds a header to the page making it permanent if needed
BrowserHeadersTrait::addHeaders public function Adds headers to current page overriding the existing ones for the next requests
BrowserHeadersTrait::getHeaders public function Returns the headers of the current page that will be used the next request
BrowserHeadersTrait::responseHeaders public function Gets the response headers after a request
BrowserHeadersTrait::setHeaders public function Given an array of headers, set such headers for the requests, removing all others
BrowserMouseEventTrait::click public function Click on a given page and element
BrowserMouseEventTrait::clickCoordinates public function Click on given coordinates, THIS DOES NOT depend on the page, it just clicks on where we are right now
BrowserMouseEventTrait::doubleClick public function Triggers a double click in a given page and element
BrowserMouseEventTrait::hover public function Hovers over an element in a given page
BrowserMouseEventTrait::rightClick public function Triggers a right click on a page an element
BrowserMouseEventTrait::scrollTo public function Scrolls the page by a given left and top coordinates
BrowserNavigateTrait::currentUrl public function Gets the current url we are in
BrowserNavigateTrait::goBack public function Goes back on the browser history if possible
BrowserNavigateTrait::goForward public function Goes forward on the browser history if possible
BrowserNavigateTrait::reload public function Reloads the current page we are in
BrowserNavigateTrait::visit public function Send a visit command to the browser
BrowserNetworkTrait::clearNetworkTraffic public function Clear the network traffic data stored on the phantomjs code
BrowserNetworkTrait::networkTraffic public function Get all the network traffic that the page have created
BrowserPageElementTrait::allHtml public function Returns the inner or outer html of the given page and element
BrowserPageElementTrait::allText public function Returns the text of a given page and element
BrowserPageElementTrait::attribute public function Returns the attribute of an element by name in a given page
BrowserPageElementTrait::attributes public function Returns the attributes of an element in a given page
BrowserPageElementTrait::deleteText public function Deletes the text of a given page and element
BrowserPageElementTrait::equals public function Check if two elements are the same on a give
BrowserPageElementTrait::find public function Find elements given a method and a selector
BrowserPageElementTrait::findWithin public function Find elements within a page, method and selector
BrowserPageElementTrait::getParents public function
BrowserPageElementTrait::keyEvent public function Sends the order to execute a key event on a given element
BrowserPageElementTrait::removeAttribute public function Remove an attribute for a given page and element
BrowserPageElementTrait::selectOption public function Sends the command to select and option given a value
BrowserPageElementTrait::setAttribute public function Set an attribute to the given element in the given page
BrowserPageElementTrait::tagName public function Gets the tag name of a given element and page
BrowserPageElementTrait::visibleText public function Returns ONLY the visible text of a given page and element
BrowserPageTrait::getBody public function Returns the body of the response to a given browser request
BrowserPageTrait::getSource public function Returns the source of the current page
BrowserPageTrait::getStatusCode public function Gets the status code of the request we are currently in
BrowserPageTrait::getTitle public function Gets the current page title
BrowserPageTrait::reset public function Resets the page we are in to a clean slate
BrowserPageTrait::resize public function Resize the current page
BrowserRenderTrait::checkRenderOptions protected function Check and fix render options
BrowserRenderTrait::render public function Renders a page or selection to a file given by path
BrowserRenderTrait::renderBase64 public function Renders base64 a page or selection to a file given by path
BrowserRenderTrait::setPaperSize public function Sets the paper size, useful when saving to PDF
BrowserScriptTrait::evaluate public function Evaluates a script on the browser
BrowserScriptTrait::execute public function Executes a script on the browser
BrowserScriptTrait::extensions public function Add desired extensions to phantomjs
BrowserWindowTrait::closeWindow public function Closes a window on the browser by a given handler name
BrowserWindowTrait::openNewWindow public function Opens a new window on the browser
BrowserWindowTrait::setZoomFactor public function Zoom factor for a web page
BrowserWindowTrait::switchToWindow public function Change the browser focus to another window
BrowserWindowTrait::windowHandle public function Returns the current window handle name in the browser
BrowserWindowTrait::windowHandles public function Returns all the window handles present in the browser
BrowserWindowTrait::windowName public function Gets the current request window name
BrowserWindowTrait::windowSize public function Gets the window size