How to handle changing absolute XPath?



  • /html/body/div/main/div/div/div[2]/div/div/div/div[1]/div/div***[4]***/div/div[2]

    The div[4] element keeps changing. If a new item comes into the web, the div number changes.

    How do I handle this?



  • If nothing in the web page is predictable, then you're hosed: you can't find gold in a sea of shifting data unless you have something to hold on to.

    If there's some constant factor in the web page that is stable, whether it's the structure, an ID value, or some textual content, then tell us what it is, and we can help you translate that description into XPath.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2