Skip to content

Commit

Permalink
feat: add locator.isEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lucgagan committed Nov 12, 2023
1 parent 42c780b commit e7b67eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Certainly! Here's a rephrased version of the provided content, presented in a ma
- `locator.innerText`
- `locator.inputValue`
- `locator.isChecked`
- `locator.isEnabled`
- `locator.isVisible`
- `locator.uncheck`
- `page.goto`
Expand Down
22 changes: 22 additions & 0 deletions src/completeTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,28 @@ export const completeTask = async (
},
},
},
{
function: async (args: { elementId: string }) => {
return { isEnabled: await getLocator(args.elementId).isEnabled() };
},
name: "locator_isEnabled",
description: "Returns whether the element is enabled. Element is considered enabled unless it is a <button>, <select>, <input> or <textarea> with a disabled property.",
parse: (args: string) => {
return z
.object({
elementId: z.string(),
})
.parse(JSON.parse(args));
},
parameters: {
type: "object",
properties: {
elementId: {
type: "string",
},
},
},
},
{
function: async (args: { elementId: string }) => {
return { isVisible: await getLocator(args.elementId).isVisible() };
Expand Down

0 comments on commit e7b67eb

Please sign in to comment.