For example I searching for something in google, than I get search results, and I need to have xpath or any other locator for summarize all links on results page? Any suggestion?
If I were doing this for a google search, first I would get the XPath of a single link. You can do this in Chrome by right clicking a link and selecting Inspect Element
, then right clicking the newly selected element, and then hitting Copy XPath
. Example:
I get //*[@id="rso"]/div[1]/li[1]/div/h3/a
from clicking that. However, this will only select a single element, because of li[1]
and div[1]
, which limit the query. You probably want to change the XPath to //*[@id="rso"]/div/li/div/h3/a
, which selects all 10 search results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.