Python Forum
To select only the latest value with Selenium
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To select only the latest value with Selenium
#1
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
Reply
#2
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)
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium press "select option" button (SOLVED) kucingkembar 0 720 Aug-10-2023, 11:49 AM
Last Post: kucingkembar
  Cannot download latest version of a file TheTechRobo 3 2,278 May-20-2020, 08:33 PM
Last Post: TheTechRobo
  Selenium: accessing a drop-down menus without select tags ClassicalSoul 0 2,058 Apr-19-2020, 03:53 PM
Last Post: ClassicalSoul
  Unable to select iframe using selenium endejoli 1 2,975 Jan-11-2018, 05:13 PM
Last Post: j.crater
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,624 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020