Answer the question
In order to leave comments, you need to log in
How to parse the last message that appears?
How to parse exactly the last appeared message using selenium?
driver.get('https://drgn.lol/')
while True:
prim = driver.find_element_by_xpath("//p[@class='message-text']").text
print(prim)
Answer the question
In order to leave comments, you need to log in
(//p[@class='message-text'])[last()]
last - returns the index of the last element in the set
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question