xref: /plugin/combo/vendor/php-webdriver/webdriver/lib/WebDriverTargetLocator.php (revision 04fd306c7c155fa133ebb3669986875d65988276)
1*04fd306cSNickeau<?php
2*04fd306cSNickeau
3*04fd306cSNickeaunamespace Facebook\WebDriver;
4*04fd306cSNickeau
5*04fd306cSNickeau/**
6*04fd306cSNickeau * Used to locate a given frame or window.
7*04fd306cSNickeau */
8*04fd306cSNickeauinterface WebDriverTargetLocator
9*04fd306cSNickeau{
10*04fd306cSNickeau    /** @var string */
11*04fd306cSNickeau    const WINDOW_TYPE_WINDOW = 'window';
12*04fd306cSNickeau    /** @var string */
13*04fd306cSNickeau    const WINDOW_TYPE_TAB = 'tab';
14*04fd306cSNickeau
15*04fd306cSNickeau    /**
16*04fd306cSNickeau     * Set the current browsing context to the current top-level browsing context.
17*04fd306cSNickeau     * This is the same as calling `RemoteTargetLocator::frame(null);`
18*04fd306cSNickeau     *
19*04fd306cSNickeau     * @return WebDriver The driver focused on the top window or the first frame.
20*04fd306cSNickeau     */
21*04fd306cSNickeau    public function defaultContent();
22*04fd306cSNickeau
23*04fd306cSNickeau    /**
24*04fd306cSNickeau     * Switch to the iframe by its id or name.
25*04fd306cSNickeau     *
26*04fd306cSNickeau     * @param WebDriverElement|null|int|string $frame The WebDriverElement, the id or the name of the frame.
27*04fd306cSNickeau     * When null, switch to the current top-level browsing context When int, switch to the WindowProxy identified
28*04fd306cSNickeau     * by the value. When an Element, switch to that Element.
29*04fd306cSNickeau     *
30*04fd306cSNickeau     * @throws \InvalidArgumentException
31*04fd306cSNickeau     * @return WebDriver The driver focused on the given frame.
32*04fd306cSNickeau     */
33*04fd306cSNickeau    public function frame($frame);
34*04fd306cSNickeau
35*04fd306cSNickeau    // TODO: Add in next major release (BC)
36*04fd306cSNickeau    ///**
37*04fd306cSNickeau    // * Switch to the parent iframe.
38*04fd306cSNickeau    // *
39*04fd306cSNickeau    // * @return WebDriver This driver focused on the parent frame
40*04fd306cSNickeau    // */
41*04fd306cSNickeau    //public function parent();
42*04fd306cSNickeau
43*04fd306cSNickeau    /**
44*04fd306cSNickeau     * Switch the focus to another window by its handle.
45*04fd306cSNickeau     *
46*04fd306cSNickeau     * @param string $handle The handle of the window to be focused on.
47*04fd306cSNickeau     * @return WebDriver The driver focused on the given window.
48*04fd306cSNickeau     * @see WebDriver::getWindowHandles
49*04fd306cSNickeau     */
50*04fd306cSNickeau    public function window($handle);
51*04fd306cSNickeau
52*04fd306cSNickeau    // TODO: Add in next major release (BC)
53*04fd306cSNickeau    //public function newWindow($windowType = self::WINDOW_TYPE_TAB);
54*04fd306cSNickeau
55*04fd306cSNickeau    /**
56*04fd306cSNickeau     * Switch to the currently active modal dialog for this particular driver instance.
57*04fd306cSNickeau     *
58*04fd306cSNickeau     * @return WebDriverAlert
59*04fd306cSNickeau     */
60*04fd306cSNickeau    public function alert();
61*04fd306cSNickeau
62*04fd306cSNickeau    /**
63*04fd306cSNickeau     * Switches to the element that currently has focus within the document currently "switched to",
64*04fd306cSNickeau     * or the body element if this cannot be detected.
65*04fd306cSNickeau     *
66*04fd306cSNickeau     * @return WebDriverElement
67*04fd306cSNickeau     */
68*04fd306cSNickeau    public function activeElement();
69*04fd306cSNickeau}
70