1. 程式人生 > >瀏覽器開發模式下xpath複製

瀏覽器開發模式下xpath複製

對一個標籤的xpath語法複製功能,Chrome做得比FireFox要好。

 

以百度首頁為例:

<link rel="stylesheet" href="https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/css/soutu.css" type="text/css" data-for="result">

 

#從Firefox複製過來xpath(使用的是絕對路徑定位)
/html/body/div[2]/div[2]/div[5]/link


#從Chrome複製過來xpath(使用的是元素屬性定位)
//*[@id="head_wrapper"]/link

 

※360瀏覽器,Opera也跟Chrome一致。