Re:Robula+: an algorithm to generate robust XPath-based loca...
by kabacha on Wednesday August 05, 2020 @03:37AM
(#24058212)
Would be nice if readme would show some actual example; now it just trails off:
[ Parent
| on HN ]
Re:Robula+: an algorithm to generate robust XPath-based loca...
by kamocyc on Wednesday August 05, 2020 @04:14AM
(#24058396)
It depends on the content of the HTML document but I agree with you.
I tried running the algorithm in Chrome. It output much shorter XPath than one copied from Chrome Developer tool.
e.g. "//*[@id="rso"]/div[4]/div/div[1]/a/h3" => "//*[contains(text(),'(text of the element)')]"
Re:Robula+: an algorithm to generate robust XPath-based loca...
by kabacha on Wednesday August 05, 2020 @05:38AM
(#24058866)
Your example seems pretty awful though. You'd rarely want to select element based on it's text
Re:Robula+: an algorithm to generate robust XPath-based loca...
by kamocyc on Wednesday August 05, 2020 @05:53AM
(#24058952)
I think the author claims the XPath is more "robust" because it doesn't depend on indexes of the elements so you can add elements without breaking the XPath. (But it is arguable which one is better ...)