When browser redirect me to telegram page, i have an alert(look at the screenshot). How can I cancel It?
I use this code, but i have an error at the second line:
alert = Alert(driver) alert.dismiss()
Error:
Screenshot of alert, which i try to close:
2
IDK which type this window has. But the easiest solution is just send "enter" to browser and window will be closed.
import org.openqa.selenium.Keys WebElement.sendKeys(Keys.RETURN);
It seems Brower Notification to me not an alert. Try with chrome options to disabled the Brower Notification
Brower Notification
Here are two ways to disabled the browser notifications.
disabled
browser notifications
from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager chrome_options = webdriver.ChromeOptions() prefs = {"profile.default_content_setting_values.notifications" : 2} chrome_options.add_experimental_option("prefs",prefs) driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=chrome_options) driver.get("specific url")
or
from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--disable-notifications") driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=chrome_options) driver.get("specific url")
Click here to cancel reply.
2
Answers
IDK which type this window has. But the easiest solution is just send "enter" to browser and window will be closed.
It seems
Brower Notification
to me not an alert.Try with chrome options to disabled the
Brower Notification
Here are two ways to
disabled
thebrowser notifications
.or