-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Last Good Version
1.49.1
First Bad Version
1.50.0
Steps to reproduce
- Run this unit test:
def test_is_enabled_not_editable_button_should_work(page: Page) -> None:
page.set_content(
"""
<input id=input1 disabled>
<textarea></textarea>
<input id=input2>
<div contenteditable="true"></div>
<span id=span1 role=textbox aria-readonly=true></span>
<span id=span2 role=textbox></span>
<button>button</button>
"""
)
button = page.locator("button")
assert button
assert button.is_enabled()
Expected behavior
The test should pass
Actual behavior
The call to button.is_enabled()
throws an error:
================================================================================================== FAILURES ===================================================================================================
__________________________________________________________________________ test_is_enabled_not_editable_button_should_work[chromium] __________________________________________________________________________
page = <Page url='about:blank'>
def test_is_enabled_not_editable_button_should_work(page: Page) -> None:
page.set_content(
"""
<input id=input1 disabled>
<textarea></textarea>
<input id=input2>
<div contenteditable="true"></div>
<span id=span1 role=textbox aria-readonly=true></span>
<span id=span2 role=textbox></span>
<button>button</button>
"""
)
button = page.locator("button")
assert button
> assert button.is_enabled()
tests/sync/test_element_handle.py:600:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
playwright/sync_api/_generated.py:17032: in is_enabled
self._sync(self._impl_obj.is_enabled(timeout=timeout))
playwright/_impl/_locator.py:484: in is_enabled
return await self._frame.is_editable(
playwright/_impl/_frame.py:339: in is_editable
return await self._channel.send("isEditable", locals_to_params(locals()))
playwright/_impl/_connection.py:61: in send
return await self._connection.wrap_api_call(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <playwright._impl._connection.Connection object at 0xffff9130dc60>, cb = <function Channel.send.<locals>.<lambda> at 0xffff8efd9a20>, is_internal = False
async def wrap_api_call(
self, cb: Callable[[], Any], is_internal: bool = False
) -> Any:
if self._api_zone.get():
return await cb()
task = asyncio.current_task(self._loop)
st: List[inspect.FrameInfo] = getattr(task, "__pw_stack__", inspect.stack())
parsed_st = _extract_stack_trace_information_from_stack(st, is_internal)
self._api_zone.set(parsed_st)
try:
return await cb()
except Exception as error:
> raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
E playwright._impl._errors.Error: Locator.is_enabled: Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]
E Call log:
E - waiting for locator("button")
playwright/_impl/_connection.py:528: Error
Additional context
Althpugh this is probably caused by this playwright commit, it seems to be a playwright-python
issue, since a similar js
test (bellow) passes in playwright
, and no error is thrown there.
The test:
it('isEnabled should work for none editable button', async ({ page }) => {
await page.setContent(`
<input id=input1 disabled>
<textarea></textarea>
<input id=input2>
<div contenteditable="true"></div>
<span id=span1 role=textbox aria-readonly=true></span>
<span id=span2 role=textbox></span>
<button>button</button>
`);
const button = page.locator('button');
expect(await button.isEnabled()).toBe(true);
});
Environment
- Operating System: [MacOS 14.7.1]
- CPU: [Apple M1 Max]
- Browser: [Chromium]
- Python Version: [3.10]
Metadata
Metadata
Assignees
Labels
No labels