Skip to content

Commit

Permalink
chore: fix the LinkeDOM e2e test (#2818)
Browse files Browse the repository at this point in the history
The e2e test have been failing since ~2 months ago because of the
LinkeDOM test.

This was happening because of the [brittle
implementation](https://github.com/WebReflection/linkedom/blob/71399b5e9128d97e3de901eebad9ce8776793a96/cjs/html/document.js#L79)
of the `title` method in LinkeDOM. On the (no JS) Crawlee homepage,
there is no `<head>` element, so LinkeDOM doesn't find the `title` and
returns empty string.
  • Loading branch information
barjin authored Jan 20, 2025
1 parent 7877cc6 commit 455f9c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/e2e/linkedom-default-ts/actor/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ crawler.router.addDefaultHandler(async ({ document, enqueueLinks, request, log }
globs: ['https://crawlee.dev/docs/**'],
});

const pageTitle = document.title;
const pageTitle = document.querySelector('title')?.textContent ?? '';
assert.notEqual(pageTitle, '');
log.info(`URL: ${url} TITLE: ${pageTitle}`);

Expand Down

0 comments on commit 455f9c7

Please sign in to comment.