recursal/MDN huggingface dataset:
icons
=====

|  |  |
| --- | --- |
| Type | `Array` |

The `icons` member specifies an array of objects representing image files that can serve as application icons for different contexts. For example, they can be used to represent the web application amongst a list of other applications, or to integrate the web application with an OS's task switcher and/or system preferences.

Examples
--------


```json
"icons": [
  {
    "src": "icon/lowres.webp",
    "sizes": "48x48",
    "type": "image/webp"
  },
  {
    "src": "icon/lowres",
    "sizes": "48x48"
  },
  {
    "src": "icon/hd\_hi.ico",
    "sizes": "72x72 96x96 128x128 256x256"
  },
  {
    "src": "icon/hd\_hi.svg",
    "sizes": "any"
  }
]
```

Values
------

Image objects may contain the following values:

| Member | Description |
| --- | --- |
| `sizes` | 
 A string containing space-separated image dimensions using the same syntax as the
 `sizes`
 attribute.
  |
| `src` | 
 The path to the image file. If `src` is a relative URL, the
 base URL will be the URL of the manifest.
  |
| `type` | 
 A hint as to the media type of the image. The purpose of this member is
 to allow a user agent to quickly ignore images with media types it does
 not support.
  |
| `purpose` | 
 Defines the purpose of the image, for example if the image is intended
 to serve some special purpose in the context of the host OS (i.e., for
 better integration).


`purpose`
 can have one or more of the following values, separated by spaces:
 * `monochrome`: A user agent can present this icon where a
 monochrome icon with a solid fill
 is needed. The color information in the icon is discarded and only
 the alpha data is used. The icon can then be used by the user agent
 like a mask over any solid fill.
* `maskable`: The image is designed with
 icon masks and safe zone
 in mind, such that any part of the image outside the safe zone can
 safely be ignored and masked away by the user agent.
* `any`: The user agent is free to display the icon in any
 context (this is the default value).
 |

Specifications
--------------

| Specification |
| --- |
| Web Application Manifest # icons-member |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
display
=======

|  |  |
| --- | --- |
| Type | `String` |

The `display` member is a string that determines the developers' preferred display mode for the website. The display mode changes how much of browser UI is shown to the user and can range from `browser` (when the full browser window is shown) to `fullscreen` (when the app is fullscreened).

**Note:** The browser follows a pre-defined fallback chain if it does not support a given mode: `fullscreen` → `standalone` → `minimal-ui` → `browser`, with `browser` being the default value if the `display` member is not specified.

**Note:** You can selectively apply CSS to your app based on the display mode, using the `display-mode` media feature. This can be used to provide a consistent user experience between launching a site from a URL and launching it from a desktop icon.

Values
------

The possible values are:

| Display Mode | Description | Fallback Display Mode |
| --- | --- | --- |
| `fullscreen` | 
 All of the available display area is used and no user agent
 chrome is shown.
  | `standalone` |
| `standalone` | 
 The application will look and feel like a standalone application. This
 can include the application having a different window, its own icon in
 the application launcher, etc. In this mode, the user agent will exclude
 UI elements for controlling navigation, but can include other UI
 elements such as a status bar.
  | `minimal-ui` |
| `minimal-ui` | 
 The application will look and feel like a standalone application, but
 will have a minimal set of UI elements for controlling navigation. The
 elements will vary by browser.
  | `browser` |
| `browser` | 
 The application opens in a conventional browser tab or new window,
 depending on the browser and platform. This is the default.
  | (None) |

Example
-------


```json
"display": "standalone"
```

Specifications
--------------

| Specification |
| --- |
| Web Application Manifest # display-member |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
theme\_color
============

|  |  |
| --- | --- |
| Type | `String` |

The `theme_color` member is a string that defines the default theme color for the application. This sometimes affects how the OS displays the site (e.g., on Android's task switcher, the theme color surrounds the site).

Examples
--------


```json
"theme\_color": "red"
```

Specifications
--------------

| Specification |
| --- |
| Web Application Manifest # theme\_color-member |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
orientation
===========

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

|  |  |
| --- | --- |
| Type | `String` |

The `orientation` member defines the default orientation for all the website's top-level browsing contexts.

**Note:** `orientation` and/or its specific values might not be supported by a user agent on various display modes because supporting them does not make sense for the particular context.

**Note:** The orientation can be changed at runtime via the Screen Orientation API.

Values
------

`orientation` can take one of the following values:

* `any`
* `natural`
* `landscape`
* `landscape-primary`
* `landscape-secondary`
* `portrait`
* `portrait-primary`
* `portrait-secondary`
Examples
--------


```json
"orientation": "portrait-primary"
```

Specifications
--------------

| Specification |
| --- |
| Web Application Manifest # orientation-member |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
prefer\_related\_applications
=============================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

|  |  |
| --- | --- |
| Type | `Boolean` |

The `prefer_related_applications` member is a boolean value that specifies that applications listed in `related_applications` should be preferred over the web application. If the `prefer_related_applications` member is set to `true`, the user agent might suggest installing one of the related applications instead of this web app.

If omitted, `prefer_related_applications` defaults to `false`.

Examples
--------


```json
"prefer\_related\_applications": true
```

Specifications
--------------

| Specification |
| --- |
| Web Application Manifest # prefer\_related\_applications-member |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
webSocketUrl
============

 With the `webSocketUrl` capability set to `true` a WebSocket server will be started in the browser, supporting bidirectional communication by using the WebDriver BiDi protocol.
 When the New Session request has the `webSocketUrl` capability set to `true`, and the session starts successfully, the value of the `capabilities` field in the response will have a `webSocketUrl` property set to the URL of the WebSocket server.

Example
-------

Requesting the WebSocket URL by setting the `webSocketUrl` capability to `true`:

Request:


```http
POST /session HTTP/1.1
{"capabilities": {"alwaysMatch": {"webSocketUrl": true}}}
```


Response:


```json
{"value":{"capabilities":{"webSocketUrl":"ws://localhost:9222/session/571f206f-c3fe-794c-9218-77fa89595eb9", [..]}, "sessionId":"571f206f-c3fe-794c-9218-77fa89595eb9"}}
```

See also
--------

* List of WebDriver capabilities
* New Session command
* Establishing a WebDriver BiDi connection
acceptInsecureCerts
===================

The **`acceptInsecureCerts` capability** communicates whether expired or invalid TLS certificates are checked when navigating. When the capability is false, an insecure certificate error will be returned as navigation encounters domains with certificate problems. Otherwise, self-signed or otherwise invalid certificates will be implicitly trusted by the browser on navigation. The capability has effect for the lifetime of the session.

Example
-------

Using the `acceptInsecureCerts` capability you can bypass, or implicitly trust, TLS certificates that the certificate service in the browser does not trust:


```python
from selenium import webdriver
from selenium.common import exceptions

session = webdriver.Firefox(capabilities={"acceptInsecureCerts": True})
session.get("https://self-signed.badssl.com/")
print(session.current_url)
```


Output:


```url
https://self-signed.badssl.com/
```

See also
--------

* List of WebDriver capabilities
* Navigate To command
* New Session command
Get Element Attribute
=====================

The *Get Element Attribute* command of the WebDriver API returns the attribute of the referenced web element. If for example the element is an `<img>`, the returned attribute is `"//TODO"`, which is equivalent to calling `Element.getAttribute` on the element. For XML/XHTML documents it may be cased differently.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/element/{element id}/attribute/{name}` |

### URL parameters

`session id`

Identifier of the session.

`element id`

Identifier of the web element to get the tag name of.

`name`

Identifier of the attribute of web element to get.

### Errors

Session not created

Session does not exist.

No such window

The `window` object has been discarded, indicating that the tab or window has been closed.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Examples
--------

Python:


```python
from selenium import webdriver

session = webdriver.Firefox()
session.get("https://google.com/?hl=en")
search_box = session.find_element_by_id("q")

print(search_box.get_attribute("id"))
```


Output:
```

q
```

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-element-attribute |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Get Timeouts
============

The *Get Timeouts* command of the WebDriver API returns the timeouts associated with the current session. The session timeout durations control such behavior as timeouts on script injection, document navigation, and element retrieval.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/timeouts` |

### URL parameters

`session id`

Identifier of the session.

### Response

The response payload is a `Timeouts` object:

`implicit`

Time in milliseconds to retry the element location strategy when finding an element. This defaults to 0, meaning the strategy is run only once.

`pageLoad`

Time in milliseconds to wait for the document to finish loading. By default WebDriver will wait five minutes (or 300,000 ms).

`script`

Scripts injected with Execute Script or Execute Async Script will run until they hit the script timeout duration, which is also given in milliseconds. The scripts will then be interrupted and a script timeout error will be returned. Defaults to 30 seconds (or 30,000 ms).

### Errors

Invalid session ID

Session does not exist.

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-timeouts |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Timeouts` object
* Set Timeouts command
* List of WebDriver commands
Get Window Rect
===============

The *Get Window Rect* command of the WebDriver API returns the size and position of the given `WebElement`. Many WebDriver clients present separate API methods for getting an element's location and dimensions, but as an optimization they both use this primitive.

The command operates on the currently selected window, and returns size and position of the operating system window. The returned `WindowRect` can be used as input for the Set Window Rect command, which is for manipulating a window's position and dimensions.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/window/rect` |

### URL parameters

`session id`

Identifier of the session.

### Response

The response payload is a `WindowRect`:

`x`

Horizontal position of the operating system window associated with `window`, equivalent to `Window.screenX`.

`y`

Vertical position of the operating system window associated with `window`, equivalent to `Window.screenY`.

`width`

Width of outer bounds of the operating system window associated with `window`, equivalent to `Window.outerWidth`.

`height`

Height of the outer bounds of the operating system window associated with `window`, equivalent to `Window.outerHeight`.

### Errors

Invalid session ID

Session does not exist.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-window-rect |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* WebWindow
* Associated commands:
    + Set Window Rect
    + Get Window Handle
    + Get Window Handles
    + Close Window
Get Window Handles
==================

The *Get Window Handles* command of the WebDriver API returns a list of all `WebWindow`s. Each tab or window, depending on whether you are using a tabbed browser, is associated by a *window handle* that is used as a reference when switching to the window.

In order to determine whether or not a particular interaction with the browser opens a new window, one can obtain the set of window handles before the interaction is performed and compare it with the set after the action is performed.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/window/handles` |

### URL parameters

`session id`

Identifier of the session.

### Errors

Invalid session ID

Session does not exist.

Example
-------

C#:


```cpp
using System.Collections.ObjectModel;
using OpenQA.Selenium.Firefox;

namespace MDNWebDriverExamples
{
    class Example
    {
        public static void Main(string[] args)
        {
            FirefoxDriver session = new FirefoxDriver();

            session.ExecuteScript("window.open()");

            ReadOnlyCollection<string> currentWindowHandles = session.WindowHandles;
        }
    }
}
```

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-window-handles |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Switch To Window command
* Get Window Handle command
* Close Window command
Get Element Property
====================

The *Get Element Property* command of the WebDriver API returns the property of the referenced web element. Given `<input value=foo>` where the user changes the value to `bar`, the returned property is `bar` rather than the initial value `foo`. This is equivalent to calling `Element.getProperty` on the element.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/element/{element id}/property/{name}` |

### URL parameters

`session id`

Identifier of the session.

`element id`

Identifier of the web element to get the tag name of.

`name`

Identifier of the property of web element to get.

### Errors

Session not created

Session does not exist.

No such window

The `window` object has been discarded, indicating that the tab or window has been closed.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Examples
--------

Python:


```python
import urllib

from selenium import webdriver

def inline(doc):
    return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))

session = webdriver.Firefox()
session.get(inline("<input value=foo>"))
textbox = driver.find_element_by_tag_name("input")
textbox.send_keys("bar")

print(text_box.get_attribute("value"))
print(text_box.get_property("value"))
```


Output:
```

foo
bar
```

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-element-property |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Get Element Attribute command
* *What is the difference between properties and attributes?* on Stack Overflow
Get Element Tag Name
====================

The *Get Element Tag Name* command of the WebDriver API returns the tag name of the referenced web element. If for example the element is an `<img>`, the returned tag name is `"IMG"`, which is equivalent to calling `Element.tagName` on the element. For XML/XHTML documents it may be cased differently.

Syntax
------

| Method | URI template |
| --- | --- |
| `GET` | `/session/{session id}/element/{element id}/name` |

### URL parameters

`session id`

Identifier of the session.

`element id`

Identifier of the web element to get the tag name of.

### Errors

Session not created

Session does not exist.

No such window

The `window` object has been discarded, indicating that the tab or window has been closed.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Examples
--------

Python:


```python
from selenium import webdriver

session = webdriver.Firefox()
session.get("https://google.com/?hl=en")
search_box = driver.find_element_by_id("q")

print(search_box.tag_name)
```


Output:
```

INPUT
```

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-get-element-tag-name |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Close Window
============

The *Close Window* command of the WebDriver API closes the current top-level browsing context (window or tab) and returns with the list of currently open `WebWindow`s. If it is the last window that is being closed, the WebDriver session will implicitly be deleted. Subsequent commands after the session is ended will therefore cause invalid session ID errors.

Syntax
------

| Method | URI template |
| --- | --- |
| `DELETE` | `/session/{session id}/window` |

### URL parameters

`session id`

Identifier of the session.

### Errors

Invalid session ID

Session does not exist.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Example
-------

Python:


```python
from selenium import webdriver

session = webdriver.Firefox()
original_window = session.window_handle

new_window = session.execute_script("return window.open()")
session.switch_to.window(new_window)

session.close()
session.switch_to.window(original_window)
```


C#:


```cpp
using OpenQA.Selenium.Firefox;

namespace MDNWebDriverExamples
{
    class Example
    {
        public static void Main(string[] args)
        {
            FirefoxDriver session = new FirefoxDriver();
            string original_window = session.CurrentWindowHandle;// Optional if you want to store the handle in a variable

            session.ExecuteScript("window.open()");
            session.SwitchTo().Window(session.WindowHandles[1]); // Switch to the second window

            session.Close(); // Close current window
            session.SwitchTo().Window(session.WindowHandles[0]); // Switch back to the first window
        }
    }
}
```

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-close-window |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Switch To Window command
* Get Window Handle command
* Get Window Handles command
New Window
==========

The *New Window* command of the WebDriver API opens a new top-level browsing context of type *window* or *tab*, and returns with a dictionary containing the *handle* of the new WebWindow and its created *type*. If the requested *type* cannot be created by the browser, the alternative type will be tried to create.

Syntax
------

| Method | URI template |
| --- | --- |
| `POST` | `/session/{session id}/window/new` |

### URL parameters

`session id`

Identifier of the session.

### Payload

The input is an object:

`type`

Requested type of top-level browsing context.

### Response

The response payload is an object:

handle

The handle of the new WebWindow.

type

The created type of top-level browsing context.

### Errors

Invalid session ID

Session does not exist.

No such window

If the `window` has been closed.

Unexpected alert open

A user prompt, such as `window.alert`, blocks execution of command until it is dealt with.

Unsupported Operation

The driver or browser doesn't support the command for some reason (e.g., when it is not possible to create a new tab or window).

Example
-------

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-new-window |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Close Window command
Set Timeouts
============

The *Set Timeouts* command of the WebDriver API sets the timeouts associated with the current session. The session timeout durations control such behavior as timeouts on script injection, document navigation, and element retrieval.

Syntax
------

| Method | URI template |
| --- | --- |
| `POST` | `/session/{session id}/timeouts` |

### URL parameters

`session id`

Identifier of the session.

### Payload

The input is a `Timeouts` object:

`implicit`

Time in milliseconds to retry the element location strategy when finding an element. This defaults to 0, meaning the strategy is run only once.

`pageLoad`

Time in milliseconds to wait for the document to finish loading. By default, WebDriver will wait five minutes (or 300,000 ms).

`script`

Scripts injected with Execute Script or Execute Async Script will run until they hit the script timeout duration, which is also given in milliseconds. The scripts will then be interrupted and a script timeout error will be returned. Defaults to 30 seconds (or 30,000 ms).

### Errors

Invalid session ID

Session does not exist.

Specifications
--------------

| Specification |
| --- |
| WebDriver # dfn-set-timeouts |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Timeouts` object
* List of WebDriver commands
Unknown error
=============

The **unknown element** error is a WebDriver error that occurs when an unspecified error occurs in the driver whilst processing a command.

An unknown error will usually be specific to a particular driver, so it's a good idea to read the error message, if any, for an indication of what happened.

See also
--------

* List of WebDriver errors
* List of WebDriver commands