From 3f904056eeddbf52fb6d09be1a1c08b52956ff16 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 8 Jan 2021 12:27:54 -0800 Subject: [PATCH] api: add isVisible, isHidden, isEnabled, isDisabled and isEditable (#4915) These methods are useful for verification in tests, e.g. ```js expect(await page.isEnabled(':text("Remove All")')).toBe(false); await page.click(':text("Add Item")'); expect(await page.isVisible('.item:text("new item")')).toBe(true); expect(await page.isEnabled(':text("Remove All")')).toBe(true); ``` --- docs/src/actionability.md | 4 +- docs/src/api/class-elementhandle.md | 28 ++- docs/src/api/class-frame.md | 45 +++++ docs/src/api/class-page.md | 45 +++++ src/client/elementHandle.ts | 30 +++ src/client/frame.ts | 30 +++ src/client/page.ts | 20 ++ src/dispatchers/elementHandlerDispatcher.ts | 20 ++ src/dispatchers/frameDispatcher.ts | 20 ++ src/protocol/channels.ts | 87 +++++++- src/protocol/protocol.yml | 56 ++++++ src/protocol/validator.ts | 27 ++- src/server/dom.ts | 77 ++++++- src/server/frames.ts | 35 ++++ src/server/injected/injectedScript.ts | 21 +- test/elementhandle-convenience.spec.ts | 51 +++++ ...ementhandle-wait-for-element-state.spec.ts | 11 + types/types.d.ts | 188 +++++++++++++++++- 18 files changed, 781 insertions(+), 14 deletions(-) diff --git a/docs/src/actionability.md b/docs/src/actionability.md index ca3ef24405..79fba5e80d 100644 --- a/docs/src/actionability.md +++ b/docs/src/actionability.md @@ -44,11 +44,11 @@ Element is considered stable when it has maintained the same bounding box for at ### Enabled -Element is considered enabled when it is not a `