0

I have a python selenium script which loads the Google chrome driver and then does some automation of an URL. Here is how I load the driver in my script:

    try:
        self.driver = webdriver.Chrome(options=options, executable_path=self.path)
    except Exception as err:
        print(str(err))
    else:
        print("Chrome driver Launched")
        self.Login_url()

    '''Login_url() and other functions defined below...

But when the code is in the try block (i.e the chrome driver is still loading), I get a number of windows message boxes pop up, like the image below :

Image

Only when I manually click "Ok" on all the message boxes, the control reaches the else part in my code, prints "Chrome driver Launched" and then moves further.

Hence I want to do this:

Write a python function in my script to first identify if the windows msgbox has popped up (this is important as the above message boxes don't popup every time I run my script). If the pop up is identified, then click ok.

How can this be handled in below options (preference of answers is in exact order)

  1. Selenium itself by adding some webdriver preferences/options ?
  2. Using python's default tkinter package for Windows GUI automation ?
  3. Using python's pywinauto package for GUI automation ?

Please help.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
dig_123
  • 2,240
  • 6
  • 35
  • 59
  • I went through the article https://stackoverflow.com/questions/12450384/does-selenium-chromedriver-currently-have-support-for-handling-pop-up-windows already. A python equivalent of something like this should help – dig_123 Nov 22 '20 at 01:53
  • Tkinter is of absolutely no use here. – Bryan Oakley Nov 22 '20 at 02:08
  • 2
    Why don't you try to fix chrome instead of developing a way of closing pop up boxes? – Flavio Moraes Nov 22 '20 at 03:02

1 Answers1

0

This error message...

image

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.


Details

As per the article How to Fix/Remove Bad Image Error Windows 10 any factor related to a file or system corruption issue can result in this error as an example, excessive system cleaning, critical program files deletion, virus or malware infection, etc. Bad Image error may occur in any version of Windows including .


Solution

This issue can be resolved by either of the following approaches:

  • Uninstall and reinstalling
  • Uninstalling the problematic Windows update can fix Bad Image error effectively. Steps:
    • Type control panel in the search box in Windows and press enter.
    • Navigate to "Programs and features".
    • On the left panel, click "View installed updates".
    • On the right panel, locate on the Windows update version that causes the Bad Image error and click "Uninstall" and restart your computer.

uninstall-windows-update.png

  • In case the Bad Image error is caused by a damaged system file, use a System File Checker to run a thorough check of file integrity and automatically repair all corrupt system files.
  • Running Windows Automatic Repair. Steps:
    • Boot Windows from a bootable installation media and go on with Repair your computer option.
    • Click "Troubleshoot" > "Advanced" options and then "Automatic Repair".
    • Wait until Windows Automatic Repair finished. Restart your computer.

fix-uefi-boot-error-9

  • Performing System Restore: Windows 10 setup turns off System Restore by default. If you've enabled the System Restore and created a system restore point beforehand, this option is the last resort you should take to fix Bad Image error. Steps:
    • Search for system restore in Windows 10, click on "Create a restore point".
    • Click "System Restore" and then choose a different restore point and hit "Next". Follow the wizard to perform the system restore to get back to the system point where no Bad Image error once occurred.

system-restore-windows-10-10

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352