1

Hi can someone help me how can i accept the alert after I click the save button ?

enter image description here

I tried the accept.alert() but its not working

enter image description here

JH N
  • 65
  • 5
  • this will help [Check if any alert exists using selenium with python](https://stackoverflow.com/questions/19003003/check-if-any-alert-exists-using-selenium-with-python) – deadshot Apr 07 '21 at 04:22
  • im getting error " alert = driver.switch_to.alert AttributeError: 'str' object has no attribute 'switch_to'" – JH N Apr 07 '21 at 05:37

1 Answers1

2

Try this with explicitly wait condition:

alert = WebDriverWait(driver, 30).until(
    EC.alert_is_present())

alert.accept()

imports:

from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
Vova
  • 3,117
  • 2
  • 15
  • 23
  • im getting an error selenium.common.exceptions.NoAlertPresentException: Message: no such alert (Session info: chrome=89.0.4389.114) – JH N Apr 09 '21 at 00:09
  • yes it did.. i tried the driver wait too but its not working.. this is the site https://webapp.bailiwik.com/ – JH N Apr 10 '21 at 04:06
  • how to add with alert? – JH N Apr 10 '21 at 05:48
  • if its okay I have another question in this thread https://stackoverflow.com/questions/67014419/how-to-click-on-item-in-ul-using-pythong-selenium?noredirect=1#comment118455749_67014419 – JH N Apr 10 '21 at 06:47