I am trying to make a program that detects ads and then removes them. This is my code so far:
from selenium import webdriver
url = input('Enter URL to detect ads from: ')
browser = webdriver.Chrome()
browser.get('http://'+url)
all_iframes = browser.find_elements_by_tag_name("iframe")
print(' ')
for iframe in all_iframes:
browser.switch_to.frame(iframe)
print("Ad Found")
browser.switch_to.default_content()
print(' ')
print('Total Ads: ' + str(len(all_iframes)))
My question is that is there a way to remove/hide these ads my program has detected?