0

I am using selenium to open a web browser (specifically Chrome) in order to login to an account. When I run my script, there is a modal dialog box that lets the user know there is an error with administrative permissions. Once the user clicks "Okay", the rest of the script runs without issue.

The problem is I need this script to run automatically. Is there a way to use Python to click the "Okay" button? The alert is not within Chrome, so .switch_to_alert() is not helpful. I've found this question asked previously but the response makes it clear it can't be done with selenium, but can it be done another way?

I've also found this source on using ctypes to handle, but I'm unable to install ctypes.

Any tips/help would be appreciated!

Mfer123
  • 40
  • 4
  • So how is a modal box being spawned from a Web Browser that isn't part of the Web page (so can't be accessed from Selenium)? That sounds suuper shady. – Sinkingpoint Jun 28 '17 at 13:29
  • What I mean by that is that it is a windows dialog box, not a chrome alert. It is a pop up box in a separate window, and chrome browser does not open until after you click "Okay". – Mfer123 Jun 28 '17 at 13:34

1 Answers1

0

I did further research and it appears that a system modal dialog box cannot be accessed with Python.

I was able to prevent the pop up from occurring at all by getting an older version of the chromedriver. Instead of the most updated (ChromeDriver 2.30), I reverted back to ChromeDriver 2.27 and my program worked without issue.

Mfer123
  • 40
  • 4