I know there are already a lot of answers, but non of them worked for me.
The alert, that I want to accept looks like this: https://i.stack.imgur.com/BB1Zz.png
It's the alert that show's up, when you try to add a new Chrome-extension.
This is my code:
subprocess.Popen(r'cu2\chrome'+str(this_task)+'.bat')
time.sleep(3)
options = Options()
options.add_experimental_option('debuggerAddress', 'localhost:'+str(this_port))
browser = webdriver.Chrome(options=options)
browser.get('https://chrome.google.com/webstore/detail/proxy-helper/hheejnkdpbnlbppabadgboahgjdikacj?hl=de')
time.sleep(4)
add_ext = browser.find_element_by_xpath('//*[@class="g-c-R webstore-test-button-label"]')
add_ext.click()
time.sleep(8)
alert = browser.switch_to_alert()
print(alert.text)
time.sleep(3)
alert.accept()
This is the error, that I get:
selenium.common.exceptions.NoAlertPresentException: Message: no such alert