Keyboard Control
Under Construction
This documentation section is currently under construction. The keyboard control features are being improved and refined to provide better functionality and more reliable behavior.
Please check back soon for comprehensive documentation on:
- Key combinations and modifiers
- Special key presses
- Advanced keyboard interactions
- Complete key reference tables
- Best practices and troubleshooting
In the meantime, you can explore the basic typing functionality documented in Human-Like Interactions.
Basic Keyboard Operations
For basic text input and simple keyboard interactions, Pydoll currently provides:
Text Input
Use type_text() for typing text with realistic timing:
import asyncio
from pydoll.browser.chromium import Chrome
async def text_input_example():
async with Chrome() as browser:
tab = await browser.start()
await tab.go_to('https://example.com/form')
# Type with realistic intervals
username = await tab.find(id="username")
await username.type_text("user@example.com", interval=0.15)
asyncio.run(text_input_example())
Special Keys
Use press_keyboard_key() for special keys:
import asyncio
from pydoll.browser.chromium import Chrome
from pydoll.constants import Key
async def special_keys_example():
async with Chrome() as browser:
tab = await browser.start()
await tab.go_to('https://example.com/form')
element = await tab.find(id="input-field")
# Press Enter
await element.press_keyboard_key(Key.ENTER)
# Press Tab
await element.press_keyboard_key(Key.TAB)
# Press Escape
await element.press_keyboard_key(Key.ESCAPE)
asyncio.run(special_keys_example())
For more advanced keyboard control features, please wait for the updated documentation.
Related Documentation
- Human-Like Interactions: Learn about realistic typing and interaction patterns
- Deep Dive: WebElement Domain: Technical details of element interactions