I am trying to use Selenium in Python to check if the text has been updated on a page. If the page has been updated it should do some command, if not it should continue to run through the loop checking every 30 seconds for an update. The below is the code I have so far (newbie so go easy on me). The idea is for the code to continually loop through the page looking for a new text added. Not sure if selenium can autorefresh the page or should add code to close the page and start from the beginning.
The code works so far, but can't figure out the loop piece.
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get("https://www.somewebsite.com/")
username = driver.find_element_by_id("user_login")
username.clear()
username.send_keys("some username")
password = driver.find_element_by_name("pwd")
password.clear()
password.send_keys("some password")
driver.find_element_by_name("wp-submit").click()
original = driver.find_element_by_css_selector('#feed > div.f-wrap > div:nth-child(1) > div.f-txt')
newer = original
while original == newer:
body = driver.find_element_by_css_selector('#feed > div.f-wrap > div:nth-child(1) > div.f-txt')
newer = body.text
time.sleep(20)
while newer != original:
print(newer)