Skip to content
Sign upLog in

How to fix this webdriver error.

Profile icon
Sbot50

I get the following error, i use selenium-webdriver and chromedriver:

(node:2400) UnhandledPromiseRejectionWarning: Error: Server terminated early with status 127 at /home/runner/statusbot/node_modules/selenium-webdriver/remote/index.js:251:52 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:2400) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:2400) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-z

this is my code:

console.info("Start"); const puppeteer = require("puppeteer"); const Discord = require("discord.js"); const client = new Discord.Client(); const Database = require("./database"); const {Builder, By, Key, until} = require('selenium-webdriver'); const chrome = require('chromedriver'); var token = process.env.DISCORD_TOKEN; var test = 0; client.login(token); client.on("ready", () => { console.info(`Logged in as ${client.user.tag}!`); client.user.setActivity("stats", { type: "WATCHING" }); test = 1; }); var db = new Database("./data.json"); db.load(); const https = require("https"); const express = require("express"); const app = express(); app.get("*", (request, response) => { response.send("404 Why did you open this"); }); app.listen(process.env.PORT); process.on("SIGTERM", function() { db.save(); console.info("Stopped"); process.exit(0); }); setInterval(async function() { if (test == 1) { if (db.read("ping") == undefined || db.read("ping") == 0) { db.write("ping", 1); } else { let newping = db.read("ping") + 1; db.write("ping", newping); } console.info("Getting Info..."); let driver = await new Builder().forBrowser('chrome').build(); try { await driver.get('https://techmods2.aternos.me'); await driver.findElement(By.name('player-image')).sendKeys('webdriver', Key.RETURN); let players = []; for (let p of await driver.findElement(By.name('player-image'))) { players.push(p.children[0].title); } let bots = 0; if (players.includes("bot1")) { bots = bots + 1; } if (players.includes("alsobot")) { bots = bots + 1; } if (players.includes("backup")) { bots = bots + 1; } if (players.includes("chatbot")) { bots = bots + 1; } players = players.length; players = players - bots; let status = ""; try { status = await driver.findElement(By.name('status-label online'))[0].innerText; } catch { status = await driver.findElement(By.name('status-label online'))[0].innerText; } let out = { players: players, bots: bots, status: status }; } catch (e) { console.info("site is unreachable"); let embed = new Discord.MessageEmbed() .addField("📊 status", "⚪ Unreachable") .addField("📋 IP", "techmods2.aternos.me") .setThumbnail( "https://cdn.glitch.com/c4aa1566-9291-4f38-8b7c-ba31f3d9ed7b%2Funknown.png?v=1593269804355" ) .setTimestamp() .setFooter("Updates every minute!"); let msg = await client.guilds.cache .get("726338357029896254") .channels.cache.get("726339280859037808") .messages.fetch({ limit: 1 }); msg = await msg.first(); await msg.edit(embed); } } }, 60000);

thx for any help!

EDIT: don't ask about the glitch link to a image, forot to update that cause i moved every bot to repl today (cause repl > glitch)

You are viewing a single comment. View All
Profile icon
Sbot50

@Coder100
oh, well im already doing it another way. if that doesnt work ill try your solution :)