Skip to content

Commit

Permalink
Wait for the *For Business* menu item to show up.
Browse files Browse the repository at this point in the history
Identified by the `--divider` subclass, on some pages, this item gets added
later.  Actually, the entire navbar content gets rebuilt, causing us to have
to reconnect the LIT menu button.

If this pans out, we can make it the official item, simplifying this code.

Issue #242.

␄
  • Loading branch information
Mike Castle committed Feb 7, 2024
1 parent 205055f commit ef704a1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions linkedin-tool.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -6630,7 +6630,26 @@
const me = 'waitOnPageLoadedEnough';
this.logger.entered(me);

// TODO(#242): If the choice of the divider class does not cause any
// problems, we should make that the official item to wait for, and then
// populate this.#navbar with a simple call to document.querySelector().
this.#navbar = await NH.web.waitForSelector('#global-nav', 0);
try {
const waitTime = 1000;
await NH.web.waitForSelector(
'.global-nav__primary-item--divider', waitTime
);
this.logger.log('Divider showed up');
} catch (e) {
this.logger.log(
'Divider did not show up, but that is all right...',
'just a way of wasting time',
e
);
if (litOptions.enableDevMode) {
NH.base.issues.post('TODO(#242): Wait for divider timed out');
}
}
this.#finishConstruction();

this.logger.leaving(me);
Expand Down

0 comments on commit ef704a1

Please sign in to comment.