#Nexus Do you have a script for this project? I have been disconnected every minute for a while, so I found a script to auto reconnect. If you want to run it, you can; it will be for three days, today is the second day. I logged in directly with Google and remember to export the generated wallet.
Open the website: https://app.nexus.xyz/
Click the switch button in the center, then click login in the upper right corner, select Google login, click continue, and a wallet address will appear in the upper right corner.
Then the center switch button will turn blue.
Now let's talk about the disconnection issue and add auto reconnect code.
Usage method: After opening the webpage - F12 - console - paste the code and press enter.
I saw this code posted by someone on Twitter and just pasted it here.
/**
* Use XPath expression to get the value of the element.
* @param {string} xpath - The XPath used to locate the element.
* @return {Node|null} Returns the found element node, or null if not found.
*/
function getElementByXPath(xpath) {
const result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
return result.singleNodeValue;
}
/**
* Handle the operation to connect to Nexus based on the page content.
*/
function connectToNexus() {
const textElement = getElementByXPath('/html/body/div[3]/div[2]/main/main/div[2]/div/div/div[1]/div[2]/div/div/p');
if (textElement) {
const textContent = textElement.textContent;
console.log(`Found text: ${textContent}`);
if (textContent === "CONNECT TO NEXUS") {
const button = getElementByXPath("/html/body/div[3]/div[2]/main/main/div[2]/div/div/div[1]/div[1]/div/div/div/div/div[2]");
if (button) {
button.click();
} else {
console.log("Connection button not found.");
}
} else {
console.log("It is not yet time to connect.");
}
} else {
console.log("Required text element not found.");
}
}
// First check will execute after 5 seconds
setTimeout(connectToNexus, 5000);
// Subsequent checks will occur every 5 seconds
setInterval(connectToNexus, 5000);