V
V
Vasya Bezdar2022-01-16 02:29:38
Python
Vasya Bezdar, 2022-01-16 02:29:38

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)

I parse messages from the chat if that

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2022-01-16
@ScriptKiddo

(//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 question

Ask a Question

731 491 924 answers to any question