'How to deal with google chrome confirmation alerts when using selenium in python?

I am trying to make a web automation program that opens my school's app. Our school is using Adobe Connect. When I try to open the installed app, it gives me a confirmation alert. Which is not inspectable and can't define any XPath or... So, how can I handle this? I have read many Q\As but I can't manage it. Here is my code:

from selenium import webdriver
import time

url = "http://78.157.45.27/eleven203/?OWASP_CSRFTOKEN=edd648edd5" \
      "e9bf51c3196210963bd5470d6c7af82e0ec636789dfafe5fc558dc&proto=true"
browser = webdriver.Chrome()
page = browser.get(url)
time.sleep(1)

my_user_name = "***"
my_password = "***"
time.sleep(1)

user_name = browser.find_element_by_id(id_="name")
password = browser.find_element_by_id(id_="pwd")
submit_button = browser.find_element_by_id(id_="login-button")
time.sleep(1)

user_name.click()
user_name.clear()
user_name.send_keys(my_user_name)

password.click()
password.clear()
password.send_keys(my_password)

submit_button.click()
time.sleep(5)

And here is the solution I tested from other questions but not worked(attach it at the end of the code above):

ale = browser.switch_to.alert()
ale.accept()

The error message:

selenium.common.exceptions.NoAlertPresentException: Message: no such alert

I also added the confirmation alert, for your ease.

enter image description here



Solution 1:[1]

An alternative way and a more secure one is to use this package. After the alert popup, you can program your app to press [Tab] and after that [Enter] in order to accept the alert.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mani