Avoiding Detection Using Selenium/Chromedriver

I’m curious about different techniques for effectively using selenium without getting bot-blocked. I’m particularly curious if there is a way to hack something together to maintain cursor position through page loads. or returning the cursor to where it was before the page loads fully and/or maybe blocking some telemetry data so that it appears not to have moved. At the very least just not show the cursor resetting to 0,0 every friggin’ page load. I feel like that is one of the primary bot signatures that are filtered out. I’m self taught and pretty new to all of this and would appreciate any pointers or thoughts. Thanks.

Hey @d1337edu , great question, and totally valid curiosity, especially if you’re learning and experimenting.

You’re right that bots often get flagged for unnatural behavior, like the mouse snapping to (0,0) or not moving at all. Selenium itself doesn’t maintain real cursor state across page loads, since it’s not designed for that level of simulation. But here are a few things that might help reduce detection:

  1. Use undetected-chromedriver: This can bypass many basic bot detection scripts. It’s a drop-in replacement for Selenium’s ChromeDriver.
  2. Simulate mouse movement manually: You can use libraries like pyautogui or JavaScript injection to simulate cursor movement. It won’t be perfect, but it can add some noise to avoid static behavior.
  3. Preserve cursor “state” visually: Before navigation, record cursor position and inject a JS script after load to move the cursor back to that spot, even if just for visual consistency. It’s not stealthy per se, but it can reduce visual flags.
  4. Avoid full page reloads: Try interacting via AJAX or dynamic content loading where possible, to reduce the bot fingerprint resets.
  5. Block or spoof telemetry: This is tricky, but tools like Puppeteer-extra-plugin-stealth (more common in JS) do this. In Selenium/Python, it’s harder but not impossible; you can block known telemetry domains via a proxy or CDP.

Just remember, there’s no perfect cloak, especially as anti-bot systems evolve quickly. But experimenting with these ideas will definitely help you learn what’s possible!

Hope this was helpful :slight_smile: