Skip to content
Discussion options

You must be logged in to vote

ChatGPT answer..

To achieve your goal of observing changes and triggering notifications when a new .novel element is added to the page, specifically extracting the text content of the h2 > a element, you can use an XPath 2.0+ expression to identify the last .novel element without any subsequent .novel siblings. This will help you isolate newly added elements.

Here's the XPath expression to achieve this:

//div[contains(@class, 'novel') and not(following-sibling::div[contains(@class, 'novel')])]/h2/a/text()

Explanation:

  • //div[contains(@class, 'novel')]: Selects all div elements that have a class containing the word "novel".
  • not(following-sibling::div[contains(@class, 'novel')]): Filters t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Hash6232
Comment options

Answer selected by Hash6232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants