0

I was going to use Selenium to crawl the web

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome('./chromedriver', options=options)
driver.get('https://steamdb.info/tag/1742/?all')
driver.implicitly_wait(3)

li = []
games = driver.find_elements_by_xpath('//*[@class="table-products.text-center.dataTable"]')

for i in games:
    time.sleep(5)
    li.append(i.get_attribute("href"))

print(li)

After accessing the steam url that I was looking for, I tried to find something called an appid

The picture below is the HTML I'm looking for

enter image description here

I'm trying to find the number next to "data-appid="

But if I run my code, nothing is saved in the "games"

1 Answer 1

1

Correct me if I'm wrong but from what I can see this steam page requires you to log-in, are you sure that when webdriver opens the page that same data is available to you ?

Additionally when using By, the correct syntax would be games = driver.find_element(By.CSS_SELECTOR('//*[@class="table-products.text-center.dataTable"]'))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.