Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | List of all members
playwright.async_api._generated.Keyboard Class Reference
Inheritance diagram for playwright.async_api._generated.Keyboard:
Inheritance graph
[legend]
Collaboration diagram for playwright.async_api._generated.Keyboard:
Collaboration graph
[legend]

Public Member Functions

None down (self, str key)
 
None up (self, str key)
 
None insert_text (self, str text)
 
None type (self, str text, *typing.Optional[float] delay=None)
 
None press (self, str key, *typing.Optional[float] delay=None)
 
- Public Member Functions inherited from playwright._impl._async_base.AsyncBase
None __init__ (self, Any impl_obj)
 
str __str__ (self)
 
None on (self, Any event, Any f)
 
None once (self, Any event, Any f)
 
None remove_listener (self, Any event, Any f)
 
- Public Member Functions inherited from playwright._impl._impl_to_api_mapping.ImplWrapper
str __repr__ (self)
 

Additional Inherited Members

- Protected Member Functions inherited from playwright._impl._async_base.AsyncBase
Callable[..., None] _wrap_handler (self, Union[Callable[..., Any], Any] handler)
 
- Protected Attributes inherited from playwright._impl._async_base.AsyncBase
 _loop
 
- Protected Attributes inherited from playwright._impl._impl_to_api_mapping.ImplWrapper
 _impl_obj
 

Member Function Documentation

◆ down()

None playwright.async_api._generated.Keyboard.down (   self,
str  key 
)
Keyboard.down

Dispatches a `keydown` event.

`key` can specify the intended
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
to generate the text for. A superset of the `key` values can be found
[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:

`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`,
etc.

Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`,
`ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.

Holding down `Shift` will type the text that corresponds to the `key` in the upper case.

If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
texts.

If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that
modifier active. To release the modifier key, use `keyboard.up()`.

After the key is pressed once, subsequent calls to `keyboard.down()` will have
[repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key,
use `keyboard.up()`.

**NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.

Parameters
----------
key : str
    Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.

◆ insert_text()

None playwright.async_api._generated.Keyboard.insert_text (   self,
str  text 
)
Keyboard.insert_text

Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.

**Usage**

```py
await page.keyboard.insert_text(\"嗨\")
```

**NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper
case.

Parameters
----------
text : str
    Sets input to the specified text value.

◆ press()

None playwright.async_api._generated.Keyboard.press (   self,
str  key,
*typing.Optional[float]   delay = None 
)
Keyboard.press

**NOTE** In most cases, you should use `locator.press()` instead.

`key` can specify the intended
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
to generate the text for. A superset of the `key` values can be found
[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:

`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`,
etc.

Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`,
`ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.

Holding down `Shift` will type the text that corresponds to the `key` in the upper case.

If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
texts.

Shortcuts such as `key: \"Control+o\"`, `key: \"Control++` or `key: \"Control+Shift+T\"` are supported as well. When
specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.

**Usage**

```py
page = await browser.new_page()
await page.goto(\"https://keycode.info\")
await page.keyboard.press(\"a\")
await page.screenshot(path=\"a.png\")
await page.keyboard.press(\"ArrowLeft\")
await page.screenshot(path=\"arrow_left.png\")
await page.keyboard.press(\"Shift+O\")
await page.screenshot(path=\"o.png\")
await browser.close()
```

Shortcut for `keyboard.down()` and `keyboard.up()`.

Parameters
----------
key : str
    Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
delay : Union[float, None]
    Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.

◆ type()

None playwright.async_api._generated.Keyboard.type (   self,
str  text,
*typing.Optional[float]   delay = None 
)
Keyboard.type

**NOTE** In most cases, you should use `locator.fill()` instead. You only need to press keys one by one if
there is special keyboard handling on the page - in this case use `locator.press_sequentially()`.

Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.

To press a special key, like `Control` or `ArrowDown`, use `keyboard.press()`.

**Usage**

```py
await page.keyboard.type(\"Hello\") # types instantly
await page.keyboard.type(\"World\", delay=100) # types slower, like a user
```

**NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.

**NOTE** For characters that are not on a US keyboard, only an `input` event will be sent.

Parameters
----------
text : str
    A text to type into a focused element.
delay : Union[float, None]
    Time to wait between key presses in milliseconds. Defaults to 0.

◆ up()

None playwright.async_api._generated.Keyboard.up (   self,
str  key 
)
Keyboard.up

Dispatches a `keyup` event.

Parameters
----------
key : str
    Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.

The documentation for this class was generated from the following file: