Я пытаюсь узнать шансы ставок на https://www.supersportbet.com/sportsbook/
Когда я запускаю свой код, он всегда случайным образом выдает 99 из +-210 доступных ставок (всегда опуская разные ставки)
Есть ли ограничение на количество элементов, которые я могу найти с помощью селена?
Вот моя программа:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
# Path to your ChromeDriver
chrome_driver_path = r"C:\Users\damon\OneDrive\code\chromedriver-win64\chromedriver.exe"
# Create a Service object
service = Service(chrome_driver_path)
# Initialize the Chrome WebDriver
driver = webdriver.Chrome(service=service)
# Open a webpage
driver.get('https://www.supersportbet.com/sportsbook/')
time.sleep(5)
bet_containers = driver.find_elements(By.CLASS_NAME, "iiDzWW")
print(f"Total containers collected: {len(bet_containers)}")
# List to hold extracted data
all_bets_info = []
# Loop through each bet container and extract the information
for bet_container in bet_containers:
try:
# Extract team names
teams = bet_container.find_elements(By.CLASS_NAME, "blaZP")
team_1_name = teams[0].text
team_2_name = teams[1].text
# Extract odds
odds_buttons = bet_container.find_elements(By.CLASS_NAME, "sc-1l5be6m-0")
odds = [odds_button.find_element(By.TAG_NAME, "span").text for odds_button in odds_buttons]
# Store the data in the list
bet_info = {
"team_1": team_1_name,
"team_2": team_2_name,
"odds": odds,
}
# Append the bet info to the list
all_bets_info.append(bet_info)
except Exception as e:
print(f"Error processing a bet: {e}")
continue
# Print all the extracted bet information
i=0
for bet in all_bets_info:
print(bet)
print(i)
i+=1
# Close the browser
driver.quit()```
Подробнее здесь: https://stackoverflow.com/questions/793 ... h-selenium
Есть ли ограничение на количество элементов, которые можно найти в селене? ⇐ Python
Программы на Python
1736943772
Anonymous
Я пытаюсь узнать шансы ставок на https://www.supersportbet.com/sportsbook/
Когда я запускаю свой код, он всегда случайным образом выдает 99 из +-210 доступных ставок (всегда опуская разные ставки)
Есть ли ограничение на количество элементов, которые я могу найти с помощью селена?
Вот моя программа:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
# Path to your ChromeDriver
chrome_driver_path = r"C:\Users\damon\OneDrive\code\chromedriver-win64\chromedriver.exe"
# Create a Service object
service = Service(chrome_driver_path)
# Initialize the Chrome WebDriver
driver = webdriver.Chrome(service=service)
# Open a webpage
driver.get('https://www.supersportbet.com/sportsbook/')
time.sleep(5)
bet_containers = driver.find_elements(By.CLASS_NAME, "iiDzWW")
print(f"Total containers collected: {len(bet_containers)}")
# List to hold extracted data
all_bets_info = []
# Loop through each bet container and extract the information
for bet_container in bet_containers:
try:
# Extract team names
teams = bet_container.find_elements(By.CLASS_NAME, "blaZP")
team_1_name = teams[0].text
team_2_name = teams[1].text
# Extract odds
odds_buttons = bet_container.find_elements(By.CLASS_NAME, "sc-1l5be6m-0")
odds = [odds_button.find_element(By.TAG_NAME, "span").text for odds_button in odds_buttons]
# Store the data in the list
bet_info = {
"team_1": team_1_name,
"team_2": team_2_name,
"odds": odds,
}
# Append the bet info to the list
all_bets_info.append(bet_info)
except Exception as e:
print(f"Error processing a bet: {e}")
continue
# Print all the extracted bet information
i=0
for bet in all_bets_info:
print(bet)
print(i)
i+=1
# Close the browser
driver.quit()```
Подробнее здесь: [url]https://stackoverflow.com/questions/79358173/is-there-a-limit-to-the-number-of-elements-that-can-be-found-with-selenium[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия