0

1[][2]Scenario:: Web page asking for a confirm box (OK /cancel) then if i click on "OK" it is asking for another confirm box (OK /cancel)

here am able to handle the first confirm box by using "alert.accept()"

But am not knowing how to handle the second confirm box.

Could someone help me out with this..

  • 1
    Is the second confirm box also an alert? Or a dialog of some sort? This will go a lot faster for you if you can provide a website (hopefully its public). – Ron Norris Apr 13 '18 at 12:35
  • Its a confirm box asking for (OK or Cancel) –  Apr 13 '18 at 12:36
  • This is why it could take awhile. It *could* be a system dialog, or it *could* be a pure HTML dialog. You have to figure out which it is. If it is a system dialog, selenium cannot interact with it. If it is HTML, selenium can probably control it. Can you tell which type it is? – Ron Norris Apr 13 '18 at 12:39
  • system dialog box –  Apr 13 '18 at 12:47
  • 1
    Then you leave the realm of selenium (at least temporarily) to deal with the dialog. Try Autoit, ctypes, or other extension to interact with the system dialog. Then when it is dismissed, you can return to controlling the web page with selenium. [Here is a link that might help](https://stackoverflow.com/questions/48229446/python-selenium-webpage-with-windows-security). – Ron Norris Apr 13 '18 at 12:56
  • Can you share your code attempts to handle both the first and second _confirm boxes_? – undetected Selenium Apr 13 '18 at 14:12
  • alert = self.driver.switch_to.alert assert "WPS requires SSID broadcasting in order to work. If you make this change, WPS will become inaccessible. Do you want to continue?" in alert.text time.sleep(5) alert.accept() wait = WebDriverWait(driver, 10) wait.until(EC.alert_is_present()) alert = self.driver.switch_to.alert assert "Are you sure that you do not want any wireless security on your network? This setting is typically used for wireless hot spots that are open to public access. Do you want to continue?" in alert.text time.sleep(5) alert.accept() –  Apr 16 '18 at 06:10

0 Answers0