[Python] Selenium won't load all the content

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    I've been lookin at this webpage, https://www.tractorsupply.com/tsc/product/welded-wire-48-in-x-100-ft to try and get the price using Beautiful Soup and Selenium with python. However, when I use selenium to access the page with this code:


    url = 'https://www.tractorsupply.com/tsc/product/welded-wire-48-in-x-100-ft'
    headers = 'Chrome/101.0.4951.41 (Windows NT 10.0; Win64; x64)'
    opts = Options()
    opts.add_argument(f"user-agent={headers}")

    driver = webdriver.Chrome(chrome_options=opts)

    driver.get(url)

    time.sleep(10)


    I get this resulting page:

    [​IMG]

    When I should be getting this page:

    [​IMG]

    I've done a little research and it seems they use JavaScript to populate those fields based on my zip code, but i'm not entirely sure becuase I don't know much about JS.

    What I really need is text value of that price and i'm not sure how to pursue that.

    Thanks

    Continue reading...

Compartilhe esta Página