how to get 'ad count' and 'ad number' on google search result page

Support
  • Screenshot_1.png

    when i do a search on google.com, i want bot to log the number of top ads & bottom ads (eg 3 top ads, 2 bottom ads) as well as to be able to point & extract info from a particular ad (eg get title of number 2 top ad).

    I could not find out the correct elements from inspection.

    Plse help. thanks.