MCPcopy Create free account
hub / github.com/microsoft/playwright-python / testEnterKey

Function testEnterKey

tests/async/test_keyboard.py:411–418  ·  view source on GitHub ↗
(key: str, expectedKey: str, expectedCode: str)

Source from the content-addressed store, hash-verified

409 lastEventHandle = await captureLastKeydown(page)
410
411 async def testEnterKey(key: str, expectedKey: str, expectedCode: str) -> None:
412 await page.keyboard.press(key)
413 lastEvent = await lastEventHandle.json_value()
414 assert lastEvent["key"] == expectedKey
415 assert lastEvent["code"] == expectedCode
416 value = await page.eval_on_selector("textarea", "t => t.value")
417 assert value == "\n"
418 await page.eval_on_selector("textarea", "t => t.value = ''")
419
420 await testEnterKey("Enter", "Enter", "Enter")
421 await testEnterKey("NumpadEnter", "Enter", "NumpadEnter")

Callers 1

test_should_press_enterFunction · 0.85

Calls 3

pressMethod · 0.45
json_valueMethod · 0.45
eval_on_selectorMethod · 0.45

Tested by

no test coverage detected