• 🌙 Community Spirit

    Ramadan Mubarak! To honor this month, Crax has paused NSFW categories. Wishing you peace and growth!

TesKoran Script "teskoran.com" (1 Viewer)

Currently reading:
 TesKoran Script "teskoran.com" (1 Viewer)

Recently searched:

xyline

Member
LV
1
Joined
Aug 9, 2023
Threads
11
Likes
8
Awards
4
Credits
1,050©
Cash
0$
JavaScript:
function getTextByClass(className) {
  const element = document.querySelector("." + className);
  if (!element) {
    return "Elemen dengan kelas " + className + " tidak ditemukan.";
  }
  const text = element.innerText;
  return text;
}

function result() {
  let result =
    parseInt(getTextByClass("soal1")) + parseInt(getTextByClass("soal2"));

  if (result >= 10) {
    result = result - 10;
  } else {
    result;
  }
  return result;
}

const timer = (ms) => new Promise((res) => setTimeout(res, ms));

async function load() {
  // We need to wrap the loop into an async function for this to work
  for (let i = 0; i < 10000; i++) {
    const resultValue = result(); // Assuming the result() function returns "1"
    console.log(resultValue);
    const selector = `.btn.pilih.btn-default.waves-effect.border.border-white[value="${resultValue}"]`;
    const buttonElement = document.querySelector(selector);

    if (buttonElement) {
      buttonElement.click();
    } else {
      console.error("Button element not found with the given selector.");
    }
    await timer(100); // then the created Promise can be awaited
  }
}

const tombolMulai = document.getElementsByClassName(
  "btn btn-primary btn-mulai"
);
tombolMulai[0].addEventListener("click", load());
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Recently searched:

Similar threads

Users who are viewing this thread

Top Bottom