2020年3月9日 星期一

[xpath] 取得 最大最小值 xpath 1.0 min and max td

[xpath] 取得 最大最小值 xpath 1.0 min and max td

由於 chrome 內的 xpath 是使用 libxml2 所以目前是 xpath 1.0
怎麼取得 td list 中的最大最大值呢?

本行歷史匯率 - 台新銀行 https://www.taishinbank.com.tw/TSB/customer-service-center/lookup/history/
//tr/td[2][not(. < //tr/td[2])]

日幣銀行買入 近一年最高最低價

2019/08/05 0.2966
2020/02/20 0.268

Max
//tr/td[2][not(. > //tr/td[2])]
0.2966
Min
//tr/td[2][not(. > //tr/td[2])]
0.268



Ref
selenium - Does Chrome use XPath 2.0? - Stack Overflow https://stackoverflow.com/questions/25455351/does-chrome-use-xpath-2-0
"No, Chrome uses XPath 1.0.
You can simplify your XPath expression to just a v2.0 function to see this:"
Google Chrome (or Chromium) still uses libxml2 thus is limited to XPath 1.0. Cf. this Readme from the source.

xml - Finding minimum value using XPath 1.0 does not work - Stack Overflow https://stackoverflow.com/questions/25982860/finding-minimum-value-using-xpath-1-0-does-not-work

沒有留言:

張貼留言