Electron.MenuItem.click is eternal, but I don't want it to be

Like the title says, Electron.MenuItem.click is eternal, but I don’t want it to be. I’m making an app for Geometry Dashers like me, and there are previous and next buttons. I have a menu that does it. Here is a snippet of my index.js file:

const menuItems = [
		new electron.MenuItem({ label: "Previous", accelerator: "CmdOrCtrl+Left", click(menuItem, browserWindow) {
			browserWindow.webContents.on("did-finish-load", async () => {
				browserWindow.webContents.executeJavaScript("document.querySelector(\".previousButton\").click();")
			});
		} }),
		new electron.MenuItem({ label: "Next", accelerator: "CmdOrCtrl+Right", click(menuItem, browserWindow) {
			browserWindow.webContents.on("did-finish-load", async () => {
				bWindow.webContents.executeJavaScript("document.querySelector(\".nextButton\").click();")
			});
		} }),
	]
	const originalMenu = electron.Menu.getApplicationMenu();
	originalMenu.items[0].submenu.append(menuItems[0]);
	originalMenu.items[0].submenu.append(menuItems[1]);

Any help would be appreciated. -J

I figured out a workaround. Just load the next page.