Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99413

Python Selenium Webdriver doesn't refresh html after changing dropdown value in AJAX pages

$
0
0

I'm trying to scrape an AJAX webpage using Python and Selenium. The problem is, when I change the dropdown value, the page content changes according to my selection, but the selenium returns the same old html code from the page. I'd appreciate if anyone can help. Here is my code:

from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time

url = "https://myurl.com/PATH"

driver = webdriver.Chrome()
driver.get(url)
time.sleep(5)

# change the dropdown value
sprintSelect = Select(driver.find_element_by_id("dropdown-select"))
sprintSelect.select_by_visible_text("DropDown_Value2")

html = driver.execute_script("return document.documentElement.outerHTML")
print(html)

Viewing all articles
Browse latest Browse all 99413

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>