IF Blocks in Ob2? How it works?

SUPER IMPORTANT: Press and Hold Button ( Puppeteer )

Someone Please help :frowning:

When I got to an login page of an website It shows Press & Hold Captcha , How should I solve it with OpenBullet 2
Like When Source Contains Please Verify , This JS Script should be executed which would Press and Hold the Button to verify ( Puppeteer )

var targetButton = document.querySelector("button[text='Press & Hold']");

if (targetButton) {
  // Found the target button, get its ID
  var targetButtonId = targetButton.getAttribute("id");
  console.log("Target button ID: " + targetButtonId);

  // Press and hold the target button
  targetButton.dispatchEvent(new Event("mousedown"));

  // Wait for 7 seconds
  setTimeout(function() {
    // Release the target button
    targetButton.dispatchEvent(new Event("mouseup"));
  }, 7000);
} else {
  console.log("Target button not found");
}

Will the above code Work I gotta change any of it?

I want an answer which can be added to my code

BLOCK:PuppeteerExecuteJs
  expression = "var targetButton = document.querySelector(\"button[text='Press & Hold']\");\r\n\r\nif (targetButton) {\r\n  // Found the target button, get its ID\r\n  var targetButtonId = targetButton.getAttribute(\"id\");\r\n  console.log(\"Target button ID: \" + targetButtonId);\r\n\r\n  // Press and hold the target button\r\n  targetButton.dispatchEvent(new Event(\"mousedown\"));\r\n\r\n  // Wait for 7 seconds\r\n  setTimeout(function() {\r\n    // Release the target button\r\n    targetButton.dispatchEvent(new Event(\"mouseup\"));\r\n  }, 7000);\r\n} else {\r\n  console.log(\"Target button not found\");\r\n}"
  => VAR @puppeteerExecuteJsOutput
ENDBLOCK
ENDIF

The ID of the Button keeps changing So I used

var targetButton = document.querySelector(\"button[text='Press & Hold']\")

Suggest me changes and Lend me your Brain CELLZZZ Plsss!!

why in the world would u ask chatgpt to write loli code for you? its super fucking easy

I know LoliCode , I was just passing time