Home > other >  Etree xpath under why can't locate the label, but the selenium and scrapy the xpath can locate?
Etree xpath under why can't locate the label, but the selenium and scrapy the xpath can locate?

Time:12-18

HTML="' & lt; Div & gt;

The window of the green office & lt;/p> 3.67 & lt;/i>/5 points & lt;/span>


"'

Xpath1='//div/@/h1/p
'Xpath2='//div/@/h1
'Xpath3='//div/@//p
'
Reason, this xpath1 can locate to p is arguably tag, but can't use this path is to visit, can only access by the relative path xpath3 to p,
Using xpath2 can also locate the h1, but as long as can't access the path to add the h1 p,

When using selenium parse this website directly using find_element_by_xpath xpath1 is can locate to p, I feel the selenium is too slow, so can need not need not

I the above HTML is use requests to obtain, and then the interception of a piece of code, this code and selenium access to this code consistent

Bosses excuse me, is this why?
  • Related