r/selenium • • Aug 03 '20

How do I take a screenshot of a page displayed in a headless browser?

65 Upvotes

So I've made a code in python that runs headless chrome, adds my ID no and name, then displays a particular page. I want to take the screenshot of this page. The code is as follows:

import bs4, requests

from selenium import webdriver

optionset= webdriver.ChromeOptions()

optionset.add_argument("headless")

browser = webdriver.Chrome (executable.path='chromedriver path', options=optionset)

browser.get("webpage'')

dataID = browser.find_element_by_name ('regno')

dataID.send_keys(key')

datapass = browser. find element_by_name ('name')

datapass. send_keys ("myname')

datapass.submit()

The code works fine in a normal tab and displays the page. But I want it to run it headless and take the screenshot. Is there a way I can take a screenshot and save it?

Edit: Solved it by simply adding browser.save_screenshot("path//screenshot.png"). I'm stupid. Have a nice day!


r/selenium • • Sep 23 '20

I made a Python bot that scrapes Udemy Coupons and then AUTOMATICALLY ENROLLS YOU to those PAID COURSES for FREE. Check out the GitHub below to get the code! :) Do Star & Fork the repository if you like it!

38 Upvotes

r/selenium • • Mar 14 '25

🛠 Is Selenium still the best choice for browser automation in 2025?

37 Upvotes

Hey everyone,

I’ve been using Selenium for browser automation, but I’m wondering if it’s still the best option in 2025. I need to automate interactions with browser extensions (password managers, wallets, etc.) while making sure automation remains as human-like as possible.

I’m also considering: ✅ Playwright – supposedly better at handling stealth automation? ✅ Puppeteer – another alternative, but how does it compare?

A few key questions: 1️⃣ Is Selenium still widely used for serious automation, or is Playwright/Puppeteer taking over? 2️⃣ What’s the best way to reduce or minimize Selenium detection?

Would love to hear from experienced users who have tested different tools. Thanks!


r/selenium • • Sep 08 '21

Resource xpath cheat sheet

37 Upvotes

This is a great resource to help with building relative xpaths

https://devhints.io/xpath

It's helped me a ton


r/selenium • • Feb 28 '20

Helium makes Selenium-Python 50% easier

35 Upvotes

r/selenium • • Feb 20 '25

Announcement We're Back! r/selenium is open to the public again

31 Upvotes

After a long hiatus, the r/selenium subreddit is no longer private/restricted, and is open to the public with new moderators! Feel free to join, post, and comment as you wish.

We hope you enjoy this community. Please be kind and respectful to others

If you would like to help moderate this community, please send a message to the Mods or DM me (u/cgoldberg).

Let's share the Selenium knowledge!


r/selenium • • Sep 11 '15

These are the guys that make the magic. The main Selenium project architects and Commiters.

Post image
30 Upvotes

r/selenium • • Nov 28 '20

Resource "Sillynium" - Auto generate working Python Selenium scripts by drawing coloured rectangles around web elements on a page that you want to automate - UPDATE from yesterday (I made this)

29 Upvotes

TLDR: 60 sec video here:https://streamable.com/1y17lt

TLDW: When I want to automate actions on a site, such as logins or forms, or scraping pages with JavaScript, I manually inspect each web element I need and begin writing a script.

I'm lazy though and had the idea to automate the creation of these automation/testing scripts. And thus "Sillynium" was born.

Sillynium allows you to draw boxes around the elements you require on a page and automatically gets the element and its properties for you. Different coloured rectangles tell the program you want to do different things. Eg: Red means "Input text", Green means "Click button".

When you've finished drawing boxes, a working python selenium script is generated. If you run that script, it does exactly what you told it to do! All this without you writing any code, and losing time.

Working 60 second video link of program in action: https://streamable.com/1y17lt

I made this project over the course of a day as a quick and dirty proof of concept. Its very flawed in its current iteration (taking a screenshot of webpage), so V2 I'm trying to figure out how to draw directly to the browser. Critique it and rip it to shreds. I'm aware of browser recorders btw so I know those exist, this is my twist on automation

Yes I posted on Python as well, but I wont post for a few weeks now :)


r/selenium • • Jul 15 '21

[meta] can we ban posts asking how to get past captchas?

27 Upvotes

Lately it feels like half the posts on this sub are different versions of "captcha in the way, how do I get past it?" or "how do I get past the cloudflare pop up?" The answers are always the same jokes about building a bot that recognizes motorcycles or power lines.

These posts take away focus from people who could genuinely use help on legitimate Selenium questions. Additionally, any site that has implemented a captcha has done so specifically to prevent automation software from interacting with the site.

It would be great if any thread asking how to bypass a captcha could be closed with a response of "you can't, and even if you could you shouldn't."


r/selenium • • Nov 17 '21

Resource How to automatically update your ChromeDriver in C#

26 Upvotes

So, I recently had an issue and I want to share my solution (for those with related issues).

I'm deploying my selenium script to a Azure pipeline. Turns out, when Chrome gets a new version, it takes days until it updates it's version.

If I update my driver locally, the azure version won't work, because the mismatch of browser and driver versions.

My solution was this library:

https://github.com/rosolko/WebDriverManager.Net

It has this method:

new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);

You can get it through the Nuget Manager Package, on Visual Studio.

It automatically checks your Chrome version and downloads/installs and uses the current version.

It worked flawlessly in my local machine and the azure server, even with my Chrome version being 96 and Azure version being 95.

Hope it helps someone out there.


r/selenium • • Oct 02 '26

browser automation tools for a qa team thats tired of maintaining its own selenium grid

24 Upvotes

weve been running our own selenium grid for like 4 years and it used to be fine

last sprint half the suite died because two nodes ran out of disk and nobody noticed until monday. spent most of tuesday just bringing the grid back up instead of actually testing anything

looking at what other qa teams moved to when they got tired of owning the browser infra. what stuck for you​


r/selenium • • Feb 20 '25

Resource My favorite selector cheat sheet

Post image
24 Upvotes

If anyone has a better one, please share!


r/selenium • • May 26 '21

Why would anyone want to use Cucumber?

21 Upvotes

So I've been automating with selenium for 8 years now and have been hearing about Cucumber for most of them. It's always suggested by some middle manager who just heard about and thinks it's the bees knees. But from what I can tell it's just a bunch of extra work that doesn't really add any value.

I'm not a Cucumber expert by any means but from what I can tell, you create a Features file that reads in plain English. But then you have to write a bunch of code that translates that plain English to actual code and calls the correct methods.

So my question is why wouldn't I just skip the middle man and call those methods directly from my test case method. Why do I need to add cucumber feature files? Can someone tell me what I'm missing here because it's clearly very popular across the industry.

I've heard it's so manual engineers and non coders can write automation but I still don't get why I need cucumber for that. Why can't they just write test cases and then I use those to write my code? It seems like the same thing with much less work.


r/selenium • • Oct 15 '26

session keeps dying mid-run on protected sites, how are you keeping auth stable

20 Upvotes

scraper thats gotta stay logged in across a few hundred pages and it just.. dies. 30ish min in the session drops, im back at the login wall, sometimes a 2fa prompt on top

saving cookies and replaying them works maybe half the time before it flags me. headful locally is fine, same script on the server gets logged out

persist the session somewhere, or just eat the re-login every run? cant tell whats worth it​


r/selenium • • Dec 09 '20

Resource "Sillynium" - Auto generate Python Selenium Scripts by drawing coloured boxes around webpage elements [OC][Now Open-Source]

20 Upvotes

TLDR:

- 45 second video showing sillynium V1 https://streamable.com/z0u7yq

- 20 second video showing sillynium V2 and early progress https://streamable.com/gp7xgp

- Github Link Github homepage

TLDW:

What it does

sillynium lets you draw boxes directly to a webpage, around webpage elements you want, and automatically gets the elements properties for you. Different colour boxes tell the program you want to do different things. Red means "Input text here"; Green means "Click this button".

Once a drawing is finished the program generates a python selenium script, that when run, does what you told it to do. No coding required. This is an open-source alternative to browser recorders, there's no stop/start and no slowly typing text, and you can also grab any element on the page, not just elements you interact with (like in recorders).

- V1 was just a concept idea that draws on a ***webpage screenshot***,

- V2 is in development. It draws ***directly to the webpage***

Open-source baby!

It's very early days, I've tried to be extremely thorough with my GitHub repo, and have highlighted TODOs!

This is a brand new open-source initiative that I'm inviting the wider coding community to join me on. Lets get this off the ground together! Still have quite alot to do :)


r/selenium • • Jan 16 '17

Selenium WebDriver Cheat Sheet - Python

Thumbnail
deerstudio.net
20 Upvotes

r/selenium • • Dec 16 '16

Chrome just got headless!

Thumbnail chromium.googlesource.com
19 Upvotes

r/selenium • • Sep 29 '26

whats the best web scraping tool that keeps sessions alive so im not babysitting a local chrome all day

18 Upvotes

running a few playwright scrapers overnight and half the time i wake up to a dead chrome process with the auth cookies gone. spent last week wiring restart hooks and cookie dumps just to keep logins alive across runs

local chrome is fine until you need more than one long session and then youre basically on-call for a browser

curious what people settled on that keeps sessions warm without sitting there nursing it​


r/selenium • • Aug 18 '26

What’s your go-to approach for Selenium testing?

18 Upvotes

I usually start with the smallest reliable layer, then use Selenium for the flows that actually need a browser.

I’m revisiting our approach because the suite is getting slower to trust as it grows. For people maintaining Selenium tests day to day: what’s your go-to setup for keeping tests readable and failures actionable?

Mostly interested in practical habits around waits, page objects or alternatives, test data, and deciding what not​ to automate in the UI.


r/selenium • • Jun 07 '16

Heads up on FF 47 update -- breaks Selenium webdriver

Thumbnail
bugzilla.mozilla.org
18 Upvotes

r/selenium • • Jun 05 '23

Don't let Reddit kill 3rd party apps!

Thumbnail reddit.com
16 Upvotes

r/selenium • • Jul 24 '22

I created a new Python package for Selenium 🚀

16 Upvotes

Hey Redditors,

Today, I am sharing a Python tool to make your bot developments easier.

It allows you to:

  • Create an Undetectable Chrome Driver

  • Control an existing Chrome driver

  • Create a Geckodriver.

  • Easily save and load cookies

  • Easily authenticate to some websites (LinkedIn)

  • A list of the most used functions (utilities) in Selenium

There is nothing special about it, but the key is that this tool has most of the repetitive functions and methods and they're ready to use quickly.

Example: Create an undetectable Chrome driver

from easy_selenium.driver.chrome.driver import Driver

driver = Driver()

chrome = driver.create()

It takes three lines of code to:

  • Download a Chrome driver with the exact version of your Chrome browser.

  • Patch it so it's no more detected as a bot.

  • Easily switch to headless mode.

  • Randomly change user agents

  • Save and load profiles

  • and more ...

The project is open source on GitHub, I've just published it today. So I would appreciate your feedback and I'm ready for any improvements.

I hope this can be useful to anyone by any means. Thanks.


r/selenium • • Apr 24 '19

Selenium 4.0.x alpha hit the market

16 Upvotes

Looks like version 4.0.x alpha got released two days ago. At least for the Java and .NET bindings. Has anyone had the pleasure of testing it out?


r/selenium • • Apr 02 '25

Showcase I built an open-source AI-powered library for web testing with Selenium

15 Upvotes

Hey r/selenium,

My name is Alex Rodionov and I'm a tech lead and Ruby maintainer of the Selenium project. For the last few months, I’ve been working on Alumnium — an open-source library that automates testing for web applications by leveraging Selenium (or Playwright), AI, and natural language commands. It’s at an early stage, but I’d be happy to get any feedback from the community!

Docs: https://alumnium.ai/
Repository: https://github.com/alumnium-hq/alumnium
Slack: #alumnium