Finding Ads on a web page
问题 I'm writing an application that's trying to determine if there are ads on a page. This is currently using brower-driving through selenium webdriver using python. I figured that a good amount of ads exist inside iframes, and I've made a loop to look inside each frame browser = webdriver.Chrome() browser.get("http://cnn.com") all_iframes = browser.find_elements_by_tag_name("iframe") for iframe in all_iframes: browser.switch_to_frame(iframe) print(browser.page_source) browser.switch_to_default