I'm a beginner to python, so please be caution with me.
I'm trying to find this on a Website:
<div class="price">$ 1.67<span class="discount">-19.71%</span></div>
I'm using Selenium like this:
#chromedriver
headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'}
ser = Service(executable_path='C:\\webdrivers\\chromedriver.exe')
options = Options()
options.page_load_strategy = 'eager'
def Function():
count = 0
global driver
with webdriver.Chrome(service=ser, options=options) as driver:
driver.get('https://cs.deals/market/csgo/Container/?name=phoeni&sort=price')
wait = WebDriverWait(driver, 10)
wait.until(page_has_loaded)
container = driver.find_element(By.ID, 'price')
print(container)
return
I also tried "By.CLASS_NAME" and "By.XPATH"
Exeption-Message: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="price"]"}
Where is my mistake?
I tried to get the first (the lowest) price, but instead I got this exeption.