// List of URLs // List of URLs const urls = [ "https://onemindpoetry.com/opportunity-for-foreign-healthcare-workers-in-canada/", "https://onemindpoetry.com/finance-jobs-in-the-uk-for-international-workers/", "https://onemindpoetry.com/healthcare-jobs-in-australia-opportunities-for-immigrants/", "https://onemindpoetry.com/job-seeker-visa-germany-jobs-application-guide/", "https://onemindpoetry.com/it-jobs-in-canada-with-visa-sponsorship-2025-guide/", "https://onemindpoetry.com/high-paying-jobs-in-canada-for-immigrants/", "https://onemindpoetry.com/truck-driver-jobs-in-the-usa-with-visa-sponsorship-your-path-to-a-rewarding-career/", "https://onemindpoetry.com/work-visa-jobs-usa-2025-complete-guide-for-sponsorship-process/", "https://onemindpoetry.com/best-companies-for-visa-sponsorship-in-the-usa/", "https://onemindpoetry.com/finance-jobs-in-the-usa-for-foreigners/", "https://onemindpoetry.com/secure-remote-jobs-in-the-usa-with-visa-sponsorship/", "https://onemindpoetry.com/healthcare-jobs-in-the-usa-for-immigrants-2025/", "https://onemindpoetry.com/lmia-approved-jobs-in-canada-your-2025-pathway-to-work-and-residency/", "https://onemindpoetry.com/it-jobs-in-usa-with-visa-sponsorship-how-to-apply-benefits/", "https://onemindpoetry.com/high-paying-jobs-in-the-usa-for-foreigners/", "https://onemindpoetry.com/h1b-visa-sponsorship-jobs-in-usa/" ]; // Retrieve visited URLs, the last completed page, and visit count from localStorage let visitedUrls = JSON.parse(localStorage.getItem("visitedUrls")) || []; let currentPageCompleted = JSON.parse(localStorage.getItem("currentPageCompleted")) || false; let visitCount = JSON.parse(localStorage.getItem("visitCount")) || 0; // Function to get a random unvisited URL function getRandomUrl() { const unvisitedUrls = urls.filter(url => !visitedUrls.includes(url)); if (unvisitedUrls.length === 0) { return null; // No unvisited URLs left } // Pick a random unvisited URL const randomIndex = Math.floor(Math.random() * unvisitedUrls.length); return unvisitedUrls[randomIndex]; } // Function to simulate realistic scrolling with varied speed and direction function scrollToFooterWithEnhancedBehavior() { return new Promise((resolve) => { const maxHeight = document.body.scrollHeight; // Total scrollable height let currentPosition = window.scrollY; function scrollStep() { if (currentPosition >= maxHeight - window.innerHeight) { console.log("Reached the footer!"); resolve(); // Scrolling to the footer is complete return; } // Scroll increment and delay const scrollDistance = Math.random() * 200 + 100; // Scroll by 100-300px const scrollDelay = Math.random() * 900 + 400; // Pause 0.5-2 seconds between scrolls // Occasionally scroll up slightly currentPosition = Math.random() > 0.15 ? Math.min(currentPosition + scrollDistance, maxHeight) // Scroll down : Math.max(currentPosition - scrollDistance / 2, 0); // Slightly scroll up // Perform the scroll window.scrollTo({ top: currentPosition, behavior: "smooth" }); // Pause for a random time before the next scroll setTimeout(scrollStep, scrollDelay); } scrollStep(); }); } // Function to perform random user activities (more diverse and human-like) function performRandomUserActivities() { return new Promise((resolve) => { const actions = [ function hoverElement() { const elements = document.querySelectorAll("a, button, img, div"); if (elements.length > 0) { const randomElement = elements[Math.floor(Math.random() * elements.length)]; console.log("Hovering over an element:", randomElement.tagName || "Unknown"); randomElement.classList.add("hover-effect"); // Simulate hover by adding a class setTimeout(() => randomElement.classList.remove("hover-effect"), 1000); // Remove hover effect after 1 second } }, function scrollSmallStep() { const smallStep = Math.random() * 100 + 50; // Scroll by 50-150px console.log("Making a small scroll step..."); window.scrollBy({ top: smallStep, behavior: "smooth" }); }, function pauseAndObserve() { const pauseTime = Math.random() * 2000 + 1000; // Pause for 2-6 seconds console.log("Pausing to observe the page for", pauseTime / 500, "seconds..."); setTimeout(resolve, pauseTime); }, function typeInInputField() { const inputFields = document.querySelectorAll("input[type='text'], input[type='search'], textarea"); if (inputFields.length > 0) { const randomField = inputFields[Math.floor(Math.random() * inputFields.length)]; console.log("Typing into a text field..."); randomField.focus(); const randomText = "This looks interesting."; // Example text let i = 0; const interval = setInterval(() => { if (i < randomText.length) { randomField.value += randomText[i]; i++; } else { clearInterval(interval); } }, 200); // Simulate typing speed setTimeout(resolve, randomText.length * 200 + 500); // Wait for typing to complete return; } resolve(); // No input fields found }, function interactWithDropdown() { const dropdowns = document.querySelectorAll("select"); if (dropdowns.length > 0) { const randomDropdown = dropdowns[Math.floor(Math.random() * dropdowns.length)]; const options = randomDropdown.options; if (options.length > 0) { const randomOptionIndex = Math.floor(Math.random() * options.length); console.log("Selecting an option from a dropdown..."); randomDropdown.selectedIndex = randomOptionIndex; // Select a random option randomDropdown.dispatchEvent(new Event("change")); // Trigger change event } } setTimeout(resolve, 1000); }, function focusAndBlurElement() { const elements = document.querySelectorAll("input, textarea, button, a"); if (elements.length > 0) { const randomElement = elements[Math.floor(Math.random() * elements.length)]; console.log("Focusing and then blurring an element:", randomElement.tagName || "Unknown"); randomElement.focus(); setTimeout(() => randomElement.blur(), 1000); // Focus for 1 second } setTimeout(resolve, 2000); }, function inspectImage() { const images = document.querySelectorAll("img"); if (images.length > 0) { const randomImage = images[Math.floor(Math.random() * images.length)]; console.log("Inspecting an image:", randomImage.src || "Unknown"); randomImage.scrollIntoView({ behavior: "smooth", block: "center" }); // Scroll image into view } setTimeout(resolve, 3000); }, function highlightText() { const paragraphs = document.querySelectorAll("p, span, div"); if (paragraphs.length > 0) { const randomParagraph = paragraphs[Math.floor(Math.random() * paragraphs.length)]; console.log("Highlighting text in a paragraph..."); const range = document.createRange(); range.selectNodeContents(randomParagraph); const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); setTimeout(() => selection.removeAllRanges(), 1000); // Clear selection after 1 second } setTimeout(resolve, 2000); }, function zoomPage() { console.log("Simulating zoom in or out..."); const zoomLevel = Math.random() > 0.5 ? 1.25 : 0.75; // Zoom in or out document.body.style.zoom = zoomLevel; setTimeout(() => (document.body.style.zoom = 1), 2000); // Reset zoom after 2 seconds setTimeout(resolve, 3000); }, function readHeaderOrFooter() { const headers = document.querySelectorAll("header, h1, h2, h3"); const footers = document.querySelectorAll("footer"); const elements = [...headers, ...footers]; if (elements.length > 0) { const randomElement = elements[Math.floor(Math.random() * elements.length)]; console.log("Reading content in header or footer..."); randomElement.scrollIntoView({ behavior: "smooth", block: "center" }); // Scroll into view } setTimeout(resolve, 2000); }, function simulateKeyboardNavigation() { console.log("Simulating keyboard navigation..."); const keyEvents = ["ArrowDown", "ArrowUp", "Tab"]; const randomKey = keyEvents[Math.floor(Math.random() * keyEvents.length)]; document.dispatchEvent(new KeyboardEvent("keydown", { key: randomKey })); setTimeout(resolve, 1000); }, ]; // Randomly pick one action and execute it const randomAction = actions[Math.floor(Math.random() * actions.length)]; randomAction(); // Pause for a random duration before resolving const randomPause = Math.random() * 3000 + 1000; // 1-4 seconds setTimeout(resolve, randomPause); }); } // Function to click the footer button function clickFooterButton() { return new Promise((resolve) => { const button = document.getElementById("randomButton"); if (button) { console.log("Clicking the footer button..."); button.click(); } else { console.log("Footer button not found."); } setTimeout(resolve, Math.random() * 3000 + 2000); // Wait 2-5 seconds after clicking }); } // Function to navigate to the next random URL function goToNextURL() { const nextUrl = getRandomUrl(); if (nextUrl) { console.log("Navigating to the next random URL:", nextUrl); visitedUrls.push(nextUrl); // Mark the URL as visited visitCount++; // Increment visit count localStorage.setItem("visitedUrls", JSON.stringify(visitedUrls)); // Save visited URLs localStorage.setItem("visitCount", visitCount); // Save visit count localStorage.setItem("currentPageCompleted", false); // Reset completion flag window.location.href = nextUrl; // Navigate to the next URL } else { alert("All URLs have been visited!"); // Show alert when all URLs are visited console.log("All URLs have been visited."); } } // Main function to simulate user behavior on the page async function automatePage() { if (currentPageCompleted) { console.log("This page has already been scrolled and interacted with. Skipping..."); return; // Exit if the page has already been completed } console.log("Starting automation on this page..."); // Scroll to the footer with enhanced behavior await scrollToFooterWithEnhancedBehavior(); // Perform multiple random user activities for (let i = 0; i < 3; i++) { await performRandomUserActivities(); } // Click the footer button await clickFooterButton(); // Mark the page as completed localStorage.setItem("currentPageCompleted", true); // If visit count reaches 4, show an alert if (visitCount === 20) { alert("5 URLs visited! Automation task almost complete!"); } // Navigate to the next random URL goToNextURL(); } // Start automation after the page loads window.addEventListener("load", () => { setTimeout(automatePage, Math.random() * 5000 + 3000); // Start after 3-8 seconds });