1

I am wondering if anyone knows a way to get page data after it updates content from a post request via Selenium. I understand that the way Selenium works is by when you get() a website it parses the content at its current state and then that is what you have have to work with but I am wondering if anyone knows how to get this updated conent without "getting" the page again?

1 Answer 1

0

You need to wait for the visibility of some static element after the page is completely updated, before you attempt to get the data inducing WebDriverWait for the visibility_of_element_located() as follows:

WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//xpath_of_static_element")))

Note : You have to add the following imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.