from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://google.com')
ids = driver.find_elements_by_xpath('//*[@id]')
for ii in ids:
    pass
Python & Selenium - how do I find all element IDs on a page?