1<?php
2
3namespace Facebook\WebDriver;
4
5use Facebook\WebDriver\Interactions\Touch\WebDriverTouchScreen;
6
7/**
8 * The interface for WebDriver.
9 */
10interface WebDriver extends WebDriverSearchContext
11{
12    /**
13     * Close the current window.
14     *
15     * @return WebDriver The current instance.
16     */
17    public function close();
18
19    /**
20     * Load a new web page in the current browser window.
21     *
22     * @param string $url
23     * @return WebDriver The current instance.
24     */
25    public function get($url);
26
27    /**
28     * Get a string representing the current URL that the browser is looking at.
29     *
30     * @return string The current URL.
31     */
32    public function getCurrentURL();
33
34    /**
35     * Get the source of the last loaded page.
36     *
37     * @return string The current page source.
38     */
39    public function getPageSource();
40
41    /**
42     * Get the title of the current page.
43     *
44     * @return string The title of the current page.
45     */
46    public function getTitle();
47
48    /**
49     * Return an opaque handle to this window that uniquely identifies it within
50     * this driver instance.
51     *
52     * @return string The current window handle.
53     */
54    public function getWindowHandle();
55
56    /**
57     * Get all window handles available to the current session.
58     *
59     * @return array An array of string containing all available window handles.
60     */
61    public function getWindowHandles();
62
63    /**
64     * Quits this driver, closing every associated window.
65     */
66    public function quit();
67
68    /**
69     * Take a screenshot of the current page.
70     *
71     * @param string $save_as The path of the screenshot to be saved.
72     * @return string The screenshot in PNG format.
73     */
74    public function takeScreenshot($save_as = null);
75
76    /**
77     * Construct a new WebDriverWait by the current WebDriver instance.
78     * Sample usage:
79     *
80     *   $driver->wait(20, 1000)->until(
81     *     WebDriverExpectedCondition::titleIs('WebDriver Page')
82     *   );
83     *
84     * @param int $timeout_in_second
85     * @param int $interval_in_millisecond
86     * @return WebDriverWait
87     */
88    public function wait(
89        $timeout_in_second = 30,
90        $interval_in_millisecond = 250
91    );
92
93    /**
94     * An abstraction for managing stuff you would do in a browser menu. For
95     * example, adding and deleting cookies.
96     *
97     * @return WebDriverOptions
98     */
99    public function manage();
100
101    /**
102     * An abstraction allowing the driver to access the browser's history and to
103     * navigate to a given URL.
104     *
105     * @return WebDriverNavigationInterface
106     * @see WebDriverNavigation
107     */
108    public function navigate();
109
110    /**
111     * Switch to a different window or frame.
112     *
113     * @return WebDriverTargetLocator
114     * @see WebDriverTargetLocator
115     */
116    public function switchTo();
117
118    // TODO: Add in next major release (BC)
119    ///**
120    // * @return WebDriverTouchScreen
121    // */
122    //public function getTouch();
123
124    /**
125     * @param string $name
126     * @param array $params
127     * @return mixed
128     */
129    public function execute($name, $params);
130
131    // TODO: Add in next major release (BC)
132    ///**
133    // * Execute custom commands on remote end.
134    // * For example vendor-specific commands or other commands not implemented by php-webdriver.
135    // *
136    // * @see https://github.com/php-webdriver/php-webdriver/wiki/Custom-commands
137    // * @param string $endpointUrl
138    // * @param string $method
139    // * @param array $params
140    // * @return mixed|null
141    // */
142    //public function executeCustomCommand($endpointUrl, $method = 'GET', $params = []);
143}
144