Why lxml isn't finding xpath given by Chrome inspector? Why lxml isn't finding xpath given by Chrome inspector? google-chrome google-chrome

Why lxml isn't finding xpath given by Chrome inspector?


That's because of the tbody tag. You see it in the browser since the tag was inserted by the browser. requests is not a browser and just downloads the page source as is:

Replace:

//*[@id="mw-content-text"]/table[1]/tbody/tr[1]/th/i

with:

//*[@id="mw-content-text"]/table[1]/tr[1]/th/i