r/SeleniumPython • • Apr 28 '23

Can't figure out how to grab elements with some lazy loading

2 Upvotes

Trying to iterate over a grid (collection) of elements, I have to continue scrolling down the page but at a point (180- elements) I get an error:

```selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document```

Here's basically what I'm trying to do:

```

for element in elements:

while True:

cls.wait_element_to_visible(driver, 50, 'group.element')
element = driver.find_element(By.CSS_SELECTOR, 'group.element')

element.DoSomething()```

Could you point me in the right direction.


r/SeleniumPython • • Apr 27 '23

100+ Selenium Python Interview Questions: Ace Your Job Interview

2 Upvotes

Are you preparing for a job interview that involves Selenium and Python? Do you want to stand out from other candidates and prove your skills? Then you need to be ready to answer tough questions about automation, web testing, data handling, and more.

That's where this ebook comes in. Written by an experienced Selenium and Python developer, it features a comprehensive list of 100+ interview questions and answers that cover all the essential topics.

Here are some of the topics covered in the book:

Basic Selenium concepts and terminology How to handle web elements and navigate pages Best practices for writing efficient and readable code How to use Selenium with Python frameworks like PyTest and Behave Common challenges in Selenium testing and how to overcome them How to integrate Selenium with other tools and technologies Each question and answer is accompanied by detailed explanations, examples, and references to official documentation and external resources. Don't let your next job interview catch you off guard. Get your copy of 100+ Selenium Python Interview Questions today and boost your confidence and expertise!

Link: https://www.amazon.com/dp/B0C3MXZT85


r/SeleniumPython • • Feb 15 '23

Scraping interval Question

2 Upvotes

I'm looking to scrape a website once an hour just for basic data. Is this too often that could trigger a captcha or would it be case by case depending on the website?


r/SeleniumPython • • Sep 08 '21

Xpath Xpaths Cheatsheet

2 Upvotes

A great resource to help with relative xpaths.

https://devhints.io/xpath


r/SeleniumPython • • Sep 08 '21

r/SeleniumPython Lounge

2 Upvotes

A place for members of r/SeleniumPython to chat with each other


r/SeleniumPython • • Aug 18 '26

Automatic waiting (autowait) to common Selenium Interactions

1 Upvotes

I wrote simple and light-weight autowait plugin for Python Selenium, it covers basic waiting situations:

  • wait for element,

  • wait for element is clickable and enabled (both buttons and inputs)

  • wait for element to be clearable

Here is the blogpost where I tell about motivation:  https://testinel.dev/blog/selenium-autowait/

Here is the repository: https://github.com/obrizan/selenium-autowait (stars, issues, PRs are welcome)

It could be installed:

pip install selenium-autowait

and then enabled:

enable_autowait()

Pytest's fixture is available too. See more in docs on GitHub.

Your feedback is welcome, and GitHub stars are welcome too!


r/SeleniumPython • • Aug 18 '26

I built Testinel because debugging failed automated tests was taking longer than writing them

Thumbnail reddit.com
1 Upvotes

r/SeleniumPython • • May 21 '26

Python Selenium download speed is very slow.

1 Upvotes

So I am having some download issues with selenium. I know my code is pretty clunky as I am a novice and built most of it using copilot. I will provide a summary of what my code does. Basically, my code goes to a website enters values in a web form and selects a file from a pre-specified file folder then clicks the submit. After that it opens a new tab waits for a download button to appear then clicks. It runs pretty fast but the problem is with the speed at which the file downloads. These files are tiny usually smaller than 1 MB and yet some take well over 10 seconds to download even though when I do the same steps in my browser without Selenium my download completes almost instantly.


r/SeleniumPython • • May 12 '26

I want to type keys like the enter key but I don't know how. Can someone help. Thanks!

Thumbnail reddit.com
1 Upvotes

r/SeleniumPython • • Apr 04 '26

Selenium I built a News Scrapper using Selenium and tkinter

Thumbnail
reddit.com
1 Upvotes

r/SeleniumPython • • Feb 19 '26

Help Selenium automation and Web Account Manager

1 Upvotes

Hey guys I'm trying to use Selenium to scrap some data from Confluence (specifically my company's confluence page). I originally used a custom profile (copying chrome user data to a different folder and then reading that to get cookies, etc) - but when I ran it as an exe file, it would get flagged as Malware - not ideal when the IT guys get random alerts. When I don't use a custom profile, I can't manually login to Confluence during runtime (I get redirected for SSO stuff, and then Conditional Access prevents doesn't allow the sign in coz the "browser, app, or location is restricted by admin")

The infosec manager said the issue is that sign in isn't happening via Microsoft Web Account Manager (WAM). I went through the documentation and it seems like that WAM token stuff is not really meant for Selenium Scripting? Am I wrong? If so, any help on how I'm supposed to implement it?


r/SeleniumPython • • Feb 10 '26

raise SeleniumConnectionException() Issue

1 Upvotes

Iam using hosted selenium url for the automation
this is my docker compose

version: "3.7"
services:
  # Selenium standalone Chrome node used by the e2e container
  selenium:
    # Use a stable, existing Selenium standalone Chrome image tag
    image: selenium/standalone-chrome:4.19.0
    container_name: selenium
    shm_size: 2g
    ports:
      - "4444:4444"
      - "5902:5900"
    networks:
      - e2e


  mongodb:
    image: mongo:latest
    container_name: mongodb
    ports:
      - 27017:27017
    networks:
      - e2e
      - elnet_dev
 
  e2e:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: e2e
    networks:
      - e2e
      - elnet_dev
    environment:
      - E2E_CI_RESULT_LOCATION=/data
      - E2E_CI_COMMIT=${COMMIT_ID}
      - E2E_SERVER_FLOW_SET=${E2E_SERVER_FLOW_SET}
    depends_on:
      - selenium
 
networks:
  e2e:
    external: false
  elnet_dev:
    external: false

It worked yesterday perfectly and able to see the UI using realVNCviewer

but today its getting this errror

File "/app/src/e2e/utils/uiautomate.py", line 111, in __init__
2026-02-09 23:04:35           self.driver = get_driver() if init_driver else None
2026-02-09 23:04:35         File "/app/src/e2e/utils/uiautomate.py", line 75, in get_driver
2026-02-09 23:04:35           raise SeleniumConnectionException()
2026-02-09 23:04:35       e2e.utils.exceptions.SeleniumConnectionException: E2E Exception

selenium url is up and running

Why this is getting error today .....not done any changes
Could you please any one help on this


r/SeleniumPython • • Feb 06 '26

Selenium X(twitter) login failed when using selenium

1 Upvotes

I tried using selenium to login to my Twitter account and post stuff for me but I Keep getting the same (try again later error from x) every input and button was selected without mistakes but ... Any comments on that ?


r/SeleniumPython • • Jan 24 '26

Help can't run in vs code

1 Upvotes

i'm on arch linux and using flatpack vs code but i keep on getting this error "Traceback (most recent call last): File "/home/l***/Documents/code/webdriver.py", line 5, in <module> driver = webdriver.Firefox(service=service) File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/firefox/webdriver.py", line 69, in __init__ super().__init__(command_executor=executor, options=self.options) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/common/webdriver.py", line 25, in __init__ super().__init__(*args, **kwargs) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/remote/webdriver.py", line 257, in __init__ self.start_session(capabilities) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/remote/webdriver.py", line 352, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/remote/webdriver.py", line 432, in execute self.error_handler.check_response(response) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/var/data/python/lib/python3.13/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status signal"


r/SeleniumPython • • Nov 18 '25

Need Help With Automating Mobile Web Testing (Python + Selenium + Proxies)

Thumbnail reddit.com
1 Upvotes

r/SeleniumPython • • Nov 11 '25

Our Playwright suite fails randomly only in CI. Has anyone tuned GitHub runner resources to fix this?

1 Upvotes

We’re seeing random Playwright test failures that only happen in CI — locally, everything passes fine.
It feels like a resource or concurrency issue (timeouts, crashes, etc.), but we’re using GitHub’s hosted runners.

Has anyone experimented with tuning runner specs (CPU/memory), using self-hosted runners, or adjusting parallelism to get more stable Playwright runs?


r/SeleniumPython • • Jul 29 '25

Selenium Trouble with emojis: unknown error: ChromeDriver only supports characters in the BMP

1 Upvotes

"File "C:\Users\kpgs6\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response

raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: unknown error: ChromeDriver only supports characters in the BMP"

I got this error, and while examining the error it disappeared after I removed an emoji. Is there any way to use emojis while sending text via script in Chromedriver?


r/SeleniumPython • • Jun 25 '25

Got started but now I'm stuck

1 Upvotes

Hi all -- I have successfully written my code to get into the webpage I want, but now I'm stuck. I am trying to locate these hyperlinks that are on 'job cards', but all of my attempts are leading to nothing happening like it cannot find the element. I have included my psuedo code and the element information when I inspect each piece of the puzzle. Any help is appreciated.

Find all job hyper links (1,491)

Click job hyperlink to go to job page

<span class="card-name-text ng-binding">SR-999: John Smith</span>

On job page click documents hyper link to go to documents page

<p class="job-activity__label">
Documents
</p>

On documents page click checkbox to select all documents

<label for="deprecated-ax-checkbox-vFIjntaG" class="ax-checkbox__label form-v3-checkbox__label form-v3-checkbox__label--empty">
            
        </label>

Click action button

<svg width="16" height="16" ax-test-selector="ax-svg__chevron-single" class="ax-svg ax-action-menu__chevron ax-svg--chevron-single f--white"><!----> <use xlink:href="/Images/icon-sprite.svg#icon-chevron-single"></use></svg>

Select download action

<span data-v-712f256e="" class="f--16">Download</span>

Go back to do again on next hyperlink at the original page.


r/SeleniumPython • • Jun 06 '25

Como puedo iterar en una tabla después de haber actualizado la página usando selenium

1 Upvotes

Estoy leyendo una tabla y posteriormente captura las filas para poder iterar. Sin embargo cuando entro al for lee la fila que necesito pero cuando hago el proceso que necesito y retrocedo mediante driver.back(), me sale error en la fila de celda = WebDriverWait(fila, 15).until(EC.presence_of_element_located((By.XPATH,".//mat-cell[8]/div/p"))).
Estuve investigando y supuestamente es porque cuando cambio de una pestaña a otro, el DOM se actualiza y ya no me encuentra dicho elemento. Pero me parece extraño. ¿Alguna solución? No soy profesional pero me gustaría poder encontrar la solución de esto

# Esperar a que la tabla esté presente
tabla = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "/html/body/app-root/app-private-container/mat-sidenav-container/mat-sidenav-content/app-resultado-consulta/div/mat-sidenav-container/mat-sidenav-content/div[5]/mat-table")))
driver.execute_script("arguments[0].scrollIntoView();", tabla)
print("Tabla de resultados cargada correctamente.")

filas = tabla.find_elements(By.XPATH, ".//mat-row") # Obtener todos los elementos que sean tipo fila (mat-row) dentro de la tabla

cantidad_pagos = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH,'/html/body/app-root/app-private-container/mat-sidenav-container/mat-sidenav-content/app-resultado-consulta/div/mat-sidenav-container/mat-sidenav-content/div[3]/div[2]/h5')))
driver.execute_script("arguments[0].scrollIntoView();", cantidad_pagos)     
numero = int(''.join(filter(str.isdigit, cantidad_pagos.text)))
    
for i, fila in enumerate(filas):
    try:
   
        celda = WebDriverWait(fila, 15).until(EC.presence_of_element_located((By.XPATH,".//mat-cell[8]/div/p")))
        celda = celda.text.strip()      
          
        # Si la nómina es Pagos Efectuados, se presiona el botón "Ver más"
        if celda == "Pagos Efectuados":
            print(f"Texto detectado: Pagos Efectuados. Presionando el botón 'Ver más'...")
            
            
            nombre_subcarpeta = WebDriverWait(fila, 15).until(EC.presence_of_element_located((By.XPATH, '//*[@id="contFolio"]')))
            nombre_subcarpeta = nombre_subcarpeta.text
            ruta_subcarpeta = os.path.join(RutaDescarga, "Pagos Efectuados", nombre_subcarpeta)

                # Crear la subcarpeta si no existe
            if not os.path.exists(ruta_subcarpeta):
                os.makedirs(ruta_subcarpeta)
                print(f"Subcarpeta creada: {ruta_subcarpeta}")
                

            try: # Presionar los 3 puntitos para abrir la descarga
                boton_puntitos = WebDriverWait(fila, 15).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='resumentmonex-desplegable-acciones']")))
                boton_puntitos.click()
                print("Botón de descarga presionado.")

            except TimeoutException:
                print("No se encontró el botón de descarga.")
                continue
            
            try:
                boton_ver_mas = WebDriverWait(fila, 15).until(
                EC.element_to_be_clickable((By.XPATH,"//div[contains(@id,'resumentmonex-vermas')]")))
                boton_ver_mas.click()   

                print("Botón 'Ver más' presionado.")

            except TimeoutException:
                print("No se encontró el botón 'Ver más'.")
                continue

            try:
                boton_detalle = WebDriverWait(fila, 15).until(
                EC.element_to_be_clickable((By.XPATH,'//*[@id="side-pendientes"]/div[1]/div[16]/div/button')))
                driver.execute_script("arguments[0].scrollIntoView();", boton_detalle) 
                boton_detalle.click()   
                print("Botón 'Dettalle' presionado.")

            except TimeoutException:
                print("No se encontró el botón 'Detalle'.")
                continue
            time.sleep(2)  # Espera 2 segundos para que la página cargue
            driver.back()

r/SeleniumPython • • Apr 30 '25

Need advice on approach

1 Upvotes

Hi have a query , I am currently practicing writing automation scripts using selenium and python and have confusion as to how to approach UI/UX icon misplacement on a website. Do i write an automation script for it or do I report defects of this kind by doing a manual test. Any advice on how to approach this test scenario is appreciated (I have highlighted the element in red)


r/SeleniumPython • • Apr 29 '25

I can’t access to site

1 Upvotes

Every day at exactly 12:00 PM, a website I’m trying to access opens for booking appointments.

But due to extremely high traffic at that specific time, the site usually crashes or becomes unresponsive, and I can’t get through to the actual form.

I’m planning to write a bot application that can automatically refresh the page at the right moment and fill in the form as soon as it becomes available.

Has anyone experienced a similar issue or built something like this?


r/SeleniumPython • • Apr 25 '25

Selenium ERRO, Estou querendo filtrar as informações do navegador. Igual na documentação.

1 Upvotes

r/SeleniumPython • • Apr 22 '25

How to solve sites that shows blank page when scraping?

1 Upvotes

Help

I'm trying to scrape a site to get product details, I have 2 functions

  1. getURL()

  2. parseData()

The getURL() functions works fine, I can get product URL of 30 pages with 8 products per page, my trouble is with parseData() function, in this function I got a blank page after click on cookie consent page. I suspect that the site knows it's robot and not human, so it blocked/stopped sending data. How can I bypass this hurdle?

  • getURL() this function walk through a product summary page with links to product detail, this function gathers the URL of each product and save to a list

  • parseData() this function uses each link gathered by previous getURL() function and get details of each product and saves to a dictionary.

ps: during troubleshooting, I can see both functions showed cookie consent form when starts, the difference is after clicking "Accept" in the getURL(), the product summary page shows up with data, but in parseData() function, it just showed a blank page. Going to the site manually, the cookie consent form shows only once, in the product summary page, not in the product details page.


r/SeleniumPython • • Mar 28 '25

Python Selenium

1 Upvotes

Hi everyone

I am stuck somewhere in Python selenium automation. The portal I want to automate doesn't allow right click on the portal so automating a website using xpath is not possible. I have tried copying the xpath using ctrl+shift+I but the script is not at all clicking the element. Can someone please guide me on it. I really need help.