Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

556
Vistas
Selenium does not find existing elements that can be found by the browser aba elements and by using js in console

I'm trying to automate the bet365 casino, I know they have tools to block bots.

link :https://casino.bet365.com/Play/LiveRoulette

I can't handle anything that's inside the div class="app-container", at least by selenium. But I find these elements using JavaScript in the browser console.

import undetected_chromedriver as UChrome
from webdriver_manager.chrome import ChromeDriverManager

UChrome.install(ChromeDriverManager().install())

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By



driver = UChrome.Chrome()
driver.get('https://www.bet365.com/#/HO/')

after login

driver.get('https://casino.bet365.com/Play/LiveRoulette')

locator = (By.XPATH,'//*[contains(@class, "second-dozen")]')

I try probably the selectors should be a little different

driver.execute_script('return document.getElementsByClassName("roulette-table-cell roulette-table-cell_side-first-dozen roulette-table-cell_group-dozen")[0].getBoundingClientRect()')

Try

driver.find_element(locator[0], locator[1])

but I recive this: raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"(//*[contains(text(), "PAR")])[1]"} (Session info: chrome=96.0.4664.110) Stacktrace: 0 0x55f8fa1bcee3

1 0x55f8f9c8a608

2 0x55f8f9cc0aa1

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You probably missing a delay / wait.
Redirecting to the inner page with

driver.get('https://casino.bet365.com/Play/LiveRoulette')

It takes some time to make all the elements loaded there, you can not access elements immediately.
The recommended way to do that is to use to use Expected Conditions explicit waits, something like this:

import undetected_chromedriver as UChrome
from webdriver_manager.chrome import ChromeDriverManager

UChrome.install(ChromeDriverManager().install())

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By


driver = UChrome.Chrome()
wait = WebDriverWait(driver, 20)
driver.get('https://www.bet365.com/#/HO/')
#perform the login here
driver.get('https://casino.bet365.com/Play/LiveRoulette')

locator = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, '//*[contains(@class, "second-dozen")]')))

I see you are also basically missing the driver.find_element method.
This:

(By.XPATH,'//*[contains(@class, "second-dozen")]')

will not return a web element.
Also make sure that element is not inside the iframe.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda