Hey everyone!
Struggling a bit here—trying to selenium find last li in ul but not getting it right. Tried a few things like `driver.find_elements_by_xpath("//ul/li")[-1]`, but it feels kinda hacky.
Is there a cleaner way? Maybe with CSS selectors or something more reliable?
Also, what if the list updates dynamically? Would love some tips or your go-to methods for this.
Thanks in advance! 🙌
(PS: If you’ve got a snippet, even better—my brain’s fried from trial and error lol.)
Struggling a bit here—trying to selenium find last li in ul but not getting it right. Tried a few things like `driver.find_elements_by_xpath("//ul/li")[-1]`, but it feels kinda hacky.
Is there a cleaner way? Maybe with CSS selectors or something more reliable?
Also, what if the list updates dynamically? Would love some tips or your go-to methods for this.
Thanks in advance! 🙌
(PS: If you’ve got a snippet, even better—my brain’s fried from trial and error lol.)
