Python Forum

Full Version: To select only the latest value with Selenium
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to click only the new post, the latest post, among the list of articles on the homepage. If it's not up to date, restart. How do I repeat this? I don't know what to look for even if I search.

The thought method sets the title or URL of the first post as the reference point, compares when a new post is posted, and restarts if the same content is true. URL Click Post If Different
Please be more specific as we know nothing about your application:
  • show URL
  • show your code
  • Show error traceback (if any) complete and unaltered (within error tags)
from selenium import webdriver
import time

path = "C:\chromed\chromedriver.exe"
driver = webdriver.Chrome(path) #chromedriver path
'''
First POST  URL
'''
driver.get("https://forums.pcgamer.com/forums/general-gaming.33/?prefix_id=1") # url
time.sleep(0.5)

posturl = driver.find_element_by_xpath("//*[@id=\"js-XFUniqueId11\"]") #list post
posturl.click()
time.sleep(0.5)

'''
UPDATA post URL Comparisons
'''
#time.sleep(1)
The first publishing URL (TXT file) storage update compares the new post to the URL of the TXT file and restarts if the URL is the same as the URL. Run if URLs are different.

I'm planning a program like this, but I don't know how.
It's python's first time, so I searched for things I didn't know, but I couldn't find what I wanted. Please help me a little.