Home > Mobile >  More simple PHP xpath query
More simple PHP xpath query

Time:02-25

My xpath query in PHP 7 to get DS Clock version: 5.0.0.2 from URL: https://www.dualitysoft.com/download.html#dsc is like this:

"//th/b[text()[contains(.,'DS Clock')]]//parent::th//parent::tr//following-sibling::tr[1]/td[1]"

Can it be more simple? I am a newbie.

CodePudding user response:

You can use this XPath:

"((//table[.//*[contains(.,'DS Clock ')]])[last()]//tr)[2]//td[1]"

Or this:

"//table//table//table//table[.//tr[@bgcolor="#8bc688"] and .//b[contains(.,'DS Clock ')]]//tr[2]/td[1]"
  • Related