'scraping a site and I get [] python selenium
I'm new to python I'm trying to get data from this site and I get []
'''url = "https://br.betano.com/casino/games/aviator/3337/fun/"'''
api_id = 44444444
api_hash = '1231313131'
client = TelegramClient('teste12', api_id, api_hash)
#client.start()
chrome_driver_path = "./chromedriver.exe"
chrome_driver_options = Options()
#chrome_driver_options.add_argument("--headless")
webdriver = webdriver.Chrome(
executable_path = chrome_driver_path,
options = chrome_driver_options
)
colors = None
def pegarsinais():
blackk = 0
redd = 0
with webdriver as driver:
wait = WebDriverWait(driver, 20)
driver.get(url)
time.sleep(10)
wait.until(presence_of_element_located((By.ID, "app")))
while True:
try:
data = [my_elem.text for my_elem in driver.find_elements(By.XPATH, "/html/body/app-root/app-game/div/div[1]/div[2]/div/div[2]/div[1]")][:1]
except:
data = [my_elem.text for my_elem in driver.find_elements(By.XPATH, "/html/body/app-root/app-game/div/div[1]/div[2]/div/div[2]/div[1]")][:1]
print(data)
time.sleep(10)
I get [] when I print data, if anyone can help me where is the error I already changed the xpath.
driver.find_elements I get empty list
driver.find_element I get error NoSuchElementException
driver.find_elements(By.CSS_SELECTOR, 'payouts-wrapper') I get empty list again
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
