diff --git a/src/element.ts b/src/element.ts index 5e59063..5f9aa36 100644 --- a/src/element.ts +++ b/src/element.ts @@ -260,19 +260,13 @@ export class Element { if (!options.button) options.button = "left"; // Scroll into view - try { - await this.#page.evaluate( - `${this.#method}('${this.#selector}').scrollIntoView({ - block: 'center', - inline: 'center', - behavior: 'instant' - })`, - ); - } catch (_e) { - await this.#page.client.close( - `The given element ("${this.#selector}") is no longer present in the DOM`, - ); - } + await this.#page.evaluate( + `${this.#method}('${this.#selector}').scrollIntoView({ + block: 'center', + inline: 'center', + behavior: 'instant' + })`, + ); // Get details we need for dispatching input events on the element const result = await this.#protocol.send< @@ -285,12 +279,6 @@ export class Element { null, ProtocolTypes.Page.GetLayoutMetricsResponse >("Page.getLayoutMetrics"); - if (!result || !result.quads.length) { - await this.#page.client.close( - `Node is either not clickable or not an HTMLElement`, - ); - } - // Ignoring because cssLayoutMetrics is present on chrome, but not firefox // deno-lint-ignore ban-ts-comment // @ts-ignore diff --git a/tests/unit/element_test.ts b/tests/unit/element_test.ts index 11a56d6..cef2c3a 100644 --- a/tests/unit/element_test.ts +++ b/tests/unit/element_test.ts @@ -12,32 +12,6 @@ const serverAdd = `http://${ for (const browserItem of browserList) { Deno.test(browserItem.name, async (t) => { await t.step("click()", async (t) => { - await t.step( - "It should fail if the element is no longer present in the DOM", - async () => { - const { page } = await buildFor(browserItem.name, { - remote, - }); - await page.location("https://drash.land"); - // Need to make the element either not clickable or not a HTMLElement - const selector = 'a[href="https://discord.gg/RFsCSaHRWK"]'; - const elem = await page.querySelector( - selector, - ); - await page.location("https://google.com"); - let errMsg = ""; - try { - await elem.click(); - } catch (e) { - errMsg = e.message; - } - assertEquals( - errMsg, - `The given element ("${selector}") is no longer present in the DOM`, - ); - }, - ); - await t.step( "It should allow clicking of elements and update location", async () => {