Basically you want to wait for the page to load and grab the element.
You can do something like this.
driver.get("https://shadowpay.com/en?price_from=0.00&price_to=34.00&game=csgo&hot_deal=true")
driver.implicitly_wait(5)
dealblock = driver.find_elements_by_css_selector("span.percent-hot-deal__block")
#print(len(dealblock))
for deal in dealblock:
print(deal.text)
The more ideal way is:
wait = WebDriverWait(driver, 10)
driver.get("https://shadowpay.com/en?price_from=0.00&price_to=34.00&game=csgo&hot_deal=true")
dealblock = wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "span.percent-hot-deal__block")))
#print(len(dealblock))
for deal in dealblock:
print(deal.text)
Imports
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…