Bad Image C:Windowssystem32xxx.dll is either not designed to run on Windows, or it contains an error using ChromeDriver and Chrome through Selenium

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.

Source: Windows Questions

LEAVE A COMMENT