Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

550
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda