recursal/MDN huggingface dataset:
JavaScript error
================

The **JavaScript** error is a WebDriver error that occurs when a script the supplied by the user fails to execute.

The underlying cause of the execution error is often supplied in the error message, along with a stacktrace provided by the JavaScript engine in the browser.

Example
-------

Consider the following injected script which tries to use an undefined variable. In JavaScript this normally causes a ReferenceError to be thrown. WebDriver catches this error and serializes it as a JavaScript error:


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

session = webdriver.Firefox()
try:
    session.execute_script("return foo")
except exceptions.JavascriptException as e:
    print(e.message)
```


Output:
```

JavascriptException: ReferenceError: foo is not defined
```

See also
--------

* List of WebDriver errors
* Associated commands:
    + Execute Script
    + Execute Async Script
Stale element reference
=======================

The **stale element reference** error is a WebDriver error that occurs because the referenced web element is no longer attached to the DOM.

 Every DOM element is represented in WebDriver by a unique identifying reference, known as a *web element*.
 The web element reference is a UUID used to execute commands targeting specific elements, such as getting an element's tag name and retrieving a property off an element.

When an element is no longer attached to the DOM, i.e. it has been removed from the document or the document has changed, it is said to be *stale*. Staleness occurs for example when you have a web element reference and the document it was retrieved from navigates.

Examples
--------

### Document navigation

Upon navigation, all web element references to the previous document will be discarded along with the document. This will cause any subsequent interaction with the web element to fail with the stale element reference error:


```python
import urllib

from selenium import webdriver
from selenium.common import exceptions

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

session = webdriver.Firefox()
session.get(inline("<strong>foo</strong>"))
foo = session.find_element_by_css_selector("strong")

session.get(inline("<i>bar</i>"))
try:
    foo.tag_name
except exceptions.StaleElementReferenceException as e:
    print(e)
```


Output:
```

StaleElementReferenceException: The element reference of e75a1764-ff73-40fa-93c1-08cb90394b65 is stale either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
```

### Node removal

When a document node is removed from the DOM, its web element reference will be invalidated. This will also cause any subsequent interaction with the web element to fail with the stale element reference error:


```python
import urllib

from selenium import webdriver
from selenium.common import exceptions

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

session = webdriver.Firefox()
session.get(inline("<button>foo</button>"))
button = session.find_element_by_css_selector("button")
session.execute_script("""
 let [button] = arguments;
 button.remove();
 """, script_args=(button,))

try:
    button.click()
except exceptions.StaleElementReferenceException as e:
    print(e)
```


Output:
```

StaleElementReferenceException: The element reference of e75a1764-ff73-40fa-93c1-08cb90394b65 is stale either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
```

See also
--------

* WebElement
* Associated commands:
    + Find Element
    + Find Elements
    + Find Element From Element
    + Find Elements From Element
Invalid cookie domain
=====================

The **invalid cookie domain** error is a WebDriver error that occurs when an illegal attempt was made to set a cookie under a different domain than that of the current document.

In WebDriver it is not permissible to set cookies for other domains than the domain of the current browsing context's document's domain.

This error will also happen if the document is *cookie-averse*, that is if the document is not loaded via `http://`, `https://`, or `ftp://`.

Example
-------

### Other domains

If the current domain were to be `example.com`, it would not be possible to add a cookie for the domain `example.org`:


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

session = webdriver.Firefox()
session.get("https://example.com/")
try:
    cookie = {"name": "foo",
              "value": "bar",
              "domain": "example.org"}
    session.add_cookie(cookie)
except exceptions.InvalidCookieDomainException as e:
    print(e.message)
```


Output:
```

InvalidCookieDomainException: https://example.org/
```

### Cookie-averse documents

This error may also occur when you visit a cookie-averse document, such as a file on your local disk:


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

session = webdriver.Firefox()
session.get("file:///home/jdoe/document.html")
try:
    foo_cookie = {"name": "foo", "value": "bar"}
    session.add_cookie(foo_cookie)
except exceptions.InvalidCookieDomainException as e:
    print(e.message)
```


Output:
```

InvalidCookieDomainException: Document is cookie-averse
```

See also
--------

* List of WebDriver errors
* Relevant WebDriver commands:
    + Add Cookie
    + Delete Cookie
    + Delete All Cookies
    + Get All Cookies
    + Get Named Cookie
Unknown command
===============

The **unknown command** error is a WebDriver error that occurs when the driver does not recognize the command/HTTP endpoint.

Examples
--------

The `/session/{session id}/foo` endpoint does not exist, and will return an unknown command error with a `404 Not Found` HTTP status code:


```bash
curl -i -d '{}' http://localhost:4444/session/foo
```



```http
HTTP/1.1 404 Not Found
Connection: close
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
Content-Length: 113
Date: Fri, 30 Mar 2018 15:30:51 GMT

{"value":{"error":"unknown command","message":"POST /session/asd did not match a known command","stacktrace":""}}
```

See also
--------

* List of WebDriver errors
* List of WebDriver commands
Invalid selector
================

The **invalid selector** error is a WebDriver error that occurs when an element retrieval command is used with an unknown web element selector strategy.

The available selector strategies are CSS, link text, partial link text, tag name, and XPath. Any other selector strategy is rejected with this error.

See also
--------

* List of WebDriver errors
* WebElement
* Element retrieval commands:
    + Find Element
    + Find Elements
    + Find Element From Element
    + Find Elements From Element
Script timeout
==============

The **script timeout** error is a WebDriver error that occurs when a script the user has provided did not complete before the session's script timeout duration expired.

The script timeout duration is a configurable capability, which means you can change how long it will take before the driver interrupts an injected script. The driver will by default wait 30 seconds before interrupting the script and returning with a script timeout error, but this can be both extended, limited, and be set to indefinite.

If the session script timeout duration is set to indefinite by using a `null` value, you are at risk of putting the session into a non-recoverable state. Be aware that this should be used with caution.

Example
-------

Consider the following asynchronous script that will resolve the promise, or invoke the callback, after 35 seconds have passed:


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

session = webdriver.Firefox()
try:
    session.execute_script("""
 let [resolve] = arguments;
 setTimeout(resolve, 35000);
 """)
except exceptions.ScriptTimeoutException as e:
    print(e.message)
```


Output:
```

ScriptTimeoutException: Timed out after 35000 ms
```


However, it is possible to *extend* the session's default script timeout by using capabilities if you have a script that you expect will take longer:


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

session = webdriver.Firefox(capabilities={"alwaysMatch": {"timeouts": {"script": 150000}}})
session.execute_script("""
 let [resolve] = arguments;
 setTimeout(resolve, 35000);
 """)
print("finished successfully")
```


Output:
```

finished successfully
```

See also
--------

* List of WebDriver errors
* Associated commands and types:
    + JavaScript error
    + Execute Script
    + Execute Async Script
Invalid session ID
==================

The **invalid session ID** error is a WebDriver error that occurs when the server does not recognize the unique session identifier. This happens if the session has been deleted or if the session ID is invalid.

Example
-------

### Explicit session deletion

A WebDriver session is explicitly deleted when quitting:


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

session = webdriver.Firefox()
print("Current session is {}".format(session.session_id))
session.quit()

try:
    session.get("https://mozilla.org")
except exceptions.InvalidSessionIdException as e:
    print(e.message)
```


Output:
```

Current session is 46197c16-8373-469b-bc56-4c4d9e4132b4
No active session with ID 46197c16-8373-469b-bc56-4c4d9e4132b4
```

### Implicit session deletion

The session can also be *implicitly deleted* if you close the last window or tab:


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

session = webdriver.Firefox()
print("Current session is {}".format(session.session_id))

# closes current window/tab
session.close()

try:
    session.get("https://mozilla.org")
except exceptions.InvalidSessionIdException as e:
    print(e.message)
```


Output:
```

Current session is 46197c16-8373-469b-bc56-4c4d9e4132b4
No active session with ID 46197c16-8373-469b-bc56-4c4d9e4132b4
```

See also
--------

* List of WebDriver errors
* Session not created
* Related WebDriver commands:
    + New Session
    + Delete Session
Invalid argument
================

The **invalid argument** error is a WebDriver error that occurs when the arguments passed to a command are either invalid or malformed.

Invalid argument errors can be likened to `TypeError`s in JavaScript, in that they can occur for a great many APIs when the input value is not of the expected type or malformed in some way. See the type- and bounds constraints for each WebDriver command.

Example
-------

It is for example not possible to set a window size to a negative value:


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

session = webdriver.Firefox()
try:
    session.set_window_size(-100, 0)
except exceptions.InvalidArgumentException as e:
    print(e.message)
```


Output:
```

InvalidArgumentException: Expected -100 to be >= 0
```

See also
--------

* List of WebDriver errors
* List of WebDriver commands
Unknown method
==============

The **unknown method** error is a WebDriver error that occurs when the driver does not recognize the HTTP request method used for the endpoint.

WebDriver provides a largely REST-ish API and not all endpoints in this API has `GET`, `POST`, and `DELETE` methods. This error occurs when you try to call an endpoint with an HTTP request method it does not support.

Examples
--------

The New Session command provides a `POST` request endpoint which lets you create new WebDriver sessions:


```bash
% curl -d '{}' http://localhost:4444/session
{"sessionId":"d4605710-5a4e-4d64-a52a-778bb0c31e00","value":{"XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","acceptSslCerts":false,"appBuildId":"20160913030425","browserName":"firefox","browserVersion":"51.0a1","command\_id":1,"platform":"LINUX","platformName":"linux","platformVersion":"4.9.0-1-amd64","processId":17474,"proxy":{},"raisesAccessibilityExceptions":false,"rotatable":false,"specificationLevel":0,"takesElementScreenshot":true,"takesScreenshot":true,"version":"51.0a1"}}
```


It also implements the `DELETE` method for ending a session:


```bash
% curl -X DELETE http://localhost:4444/session/d4605710-5a4e-4d64-a52a-778bb0c31e00
{}
```


But it does not, for example, provide a `GET` method, and this will consequently return an unknown method error:


```bash
% curl http://localhost:4444/session/650f9df3-740e-314c-958d-307e41752fae
{"value":{"error":"unknown command","message":"GET /session/650f9df3-740e-314c-958d-307e41752fae did not match a known command","stacktrace":""}}%
```

See also
--------

* List of WebDriver errors
* List of WebDriver commands
Insecure certificate
====================

The **insecure certificate** error is a WebDriver error that occurs when the remotely controlled browser hits a certificate warning of any kind. This is usually the result of navigating to a website with an expired or invalid TLS certificate. Examples of invalid certificates include self-signed, revoked, and cryptographically insecure certificates.

Web browsers prevent and block traffic to domains with broken certificates since the communication with the server would be compromised. It is strongly recommended to fix the certificate situation instead of disabling certificate checks, even in test environments.

WebDriver does offer an `acceptInsecureCerts` capability for disabling certificate checks for the length of the session's duration, but it is important to emphasize that its use is highly discouraged and that using it is widely considered a weakness of the test environment.

Example
-------

This is what will happen when navigating to a domain that has a self-signed TLS certificate using the Python client:


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

session = webdriver.Firefox()
try:
    session.get("https://self-signed.badssl.com/")
except exceptions.InsecureCertificateException as e:
    print("Hit insecure cert on {}".format(session.current_url))
```


Output:
```

Hit an insecure cert on https://self-signed.badssl.com/
```

See also
--------

* Navigate To command
* Capabilities
* badssl.com
HTML reference
==============

This HTML reference describes all **elements** and **attributes** of HTML, including **global attributes** that apply to all elements.

HTML element reference

This page lists all the HTML elements, which are created using tags.

HTML attribute reference

Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want.

Global attributes

Global attributes are attributes common to all HTML elements; they can be used on all elements, though they may have no effect on some elements.

Content categories

Every HTML element is a member of one or more content categories — these categories group elements that share common characteristics.

Date and time formats used in HTML

Certain HTML elements allow you to specify dates and/or times as the value or as the value of an attribute. These include the date and time variations of the `<input>` element as well as the `<ins>` and `<del>` elements.
HTML attribute: elementtiming
=============================

The **`elementtiming`** attribute is used to indicate that an element is flagged for tracking by `PerformanceObserver` objects using the `"element"` type. For more details, see the `PerformanceElementTiming` interface.

This attribute may be applied to `<img>`, `<image>` elements inside an `<svg>`, poster images of `<video>` elements, elements which have a `background-image`, and elements containing text nodes, such as a `<p>`.

In the DOM, this attribute is reflected as `Element.elementTiming`.

Usage
-----

The value given for `elementtiming` becomes an identifier for the observed element.


```html
<img alt="alt" src="img.jpg" elementtiming="label for element" />
```


Good contenders for elements you might want to observe are:

* The main image for an article.
* A blog post title
* Images in a carousel for a shopping site.
* The poster image for the main video on a page.
Examples
--------


```html
<img alt="Alt for a main blog post image" src="my-massive-image.jpg" elementtiming="Main image">

<p elementtiming="important-text">Some very important information.</p">
```

See also
--------

* `PerformanceElementTiming`
* `Element.elementTiming`
HTML attribute: size
====================

The **`size`** attribute defines the width of the `<input>` and the height of the `<select>` element. For the `input`, if the `type` attribute is text or password then it's the number of characters. This must be an integer value of 0 or higher. If no `size` is specified, or an invalid value is specified, the input has no size declared, and the form control will be the default width based on the user agent. If CSS targets the element with properties impacting the width, CSS takes precedence.

The `size` attribute has no impact on constraint validation.

Try it
------

Examples
--------

By adding `size` on some input types, the width of the input can be controlled. Adding size on a select changes the height, defining how many options are visible in the closed state.


```html
<label for="fruit">Enter a fruit</label>
<input type="text" size="15" id="fruit" />
<label for="vegetable">Enter a vegetable</label>
<input type="text" id="vegetable" />

<select name="fruits" size="5">
  <option>banana</option>
  <option>cherry</option>
  <option>strawberry</option>
  <option>durian</option>
  <option>blueberry</option>
</select>

<select name="vegetables" size="5">
  <option>carrot</option>
  <option>cucumber</option>
  <option>cauliflower</option>
  <option>celery</option>
  <option>collard greens</option>
</select>
```

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

#### No specification found

No specification data found for `html.elements.attribute.size`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

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

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

See also
--------

* `maxlength`
* `minlength`
* `pattern`
HTML attribute: minlength
=========================

The **`minlength`** attribute defines the minimum string length that the user can enter into an `<input>` or `<textarea>`. The attribute must have an integer value of 0 or higher.

The length is measured in UTF-16 code units, which (for most scripts) is equivalent to the number of characters. If no `minlength` is specified, or an invalid value is specified, the input has no minimum length. This value must be less than or equal to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria.

The input will fail constraint validation if the length of the text value of the field is less than minlength UTF-16 code units long, with `validityState.tooShort` returning `true`. Constraint validation is only applied when the value is changed by the user. Once submission fails, some browsers will display an error message indicating the minimum length required and the current length.

Try it
------

Examples
--------

By adding `minlength="5"`, the value must either be empty or five characters or longer to be valid.


```html
<label for="fruit">Enter a fruit name that is at least 5 letters long</label>
<input type="text" minlength="5" id="fruit" />
```


We can use pseudoclasses to style the element based on whether the value is valid. The value will be valid as long as it is either null (empty) or five or more characters long. *Lime* is invalid, *lemon is valid*.


```css
input {
  border: 2px solid currentcolor;
}
input:invalid {
  border: 2px dashed red;
}
input:invalid:focus {
  background-image: linear-gradient(pink, lightgreen);
}
```

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

| Specification |
| --- |
| HTML Standard # the-maxlength-and-minlength-attributes |

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

### html.elements.input.minlength

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

### html.elements.textarea.minlength

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

See also
--------

* `maxlength`
* `size`
* `pattern`
* Constraint validation
* Form validation
* `<input>`
HTML attribute: capture
=======================

The **`capture`** attribute specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the `accept` attribute.

Values include `user` and `environment`. The capture attribute is supported on the file input type.

The `capture` attribute takes as its value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types.

| Value | Description |
| --- | --- |
| `user` | The user-facing camera and/or microphone should be used. |
| `environment` | The outward-facing camera and/or microphone should be used |

**Note:** Capture was previously a Boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input.

Try it
------

Examples
--------

When set on a file input type, operating systems with microphones and cameras will display a user interface allowing the selection from an existing file or the creating of a new one.


```html
<p>
  <label for="soundFile">What does your voice sound like?:</label>
  <input type="file" id="soundFile" capture="user" accept="audio/\*" />
</p>
<p>
  <label for="videoFile">Upload a video:</label>
  <input type="file" id="videoFile" capture="environment" accept="video/\*" />
</p>
<p>
  <label for="imageFile">Upload a photo of yourself:</label>
  <input type="file" id="imageFile" capture="user" accept="image/\*" />
</p>
```


Note these work better on mobile devices; if your device is a desktop computer, you'll likely get a typical file picker.

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

| Specification |
| --- |
| HTML Media Capture # dfn-capture |

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

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

See also
--------

* Using files from web applications
* File API
* `HTMLInputElement.files`
HTML attribute: maxlength
=========================

The **`maxlength`** attribute defines the maximum string length that the user can enter into an `<input>` or `<textarea>`. The attribute must have an integer value of 0 or higher.

The length is measured in UTF-16 code units, which (for most scripts) is equivalent to the number of characters. If no `maxlength` is specified, or an invalid value is specified, the input has no maximum length.

Any `maxlength` value must be greater than or equal to the value of `minlength`, if present and valid. The input will fail constraint validation if the length of the text value of the field is greater than maxlength UTF-16 code units long. Constraint validation is only applied when the value is changed by the user.

### Constraint validation

While the browser will generally prevent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only `tooLong` property of a `ValidityState` object will be true.

Try it
------

Examples
--------


```html
<input type="password" maxlength="4" />
```

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

| Specification |
| --- |
| HTML Standard # the-maxlength-and-minlength-attributes |

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

### html.elements.input.maxlength

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

### html.elements.textarea.maxlength

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

See also
--------

* `minlength`
* `size`
* `pattern`
* Constraint validation
* Form validation
* `<input>`