I have created a python script that I can execute and does exactly what I want under the Google Chromedriver. However, to make sure that my executable can work on all PCs, I would like to have my script work with the internet explorer driver but I am having issues. I have attached a sample test code I am trying to run below along with the error message I am receiving.
from selenium import webdriver
driver = webdriver.Ie()
driver.get("google.com")
And the error code I am receiving is:
selenium.common.exceptions.WebDriverException: Message: Unexpected error
launching Internet Explorer. IELaunchURL() returned HRESULT 800700C1 ('%1 is
not a valid Win32 application.') for URL 'http://localhost:58689/'
Any ideas? I have installed the IEdriver and placed it on my desktop along with the test.py file I mentioned above.
You have to consider a couple of facts here:
While working with Selenium 3.4.0
downloading the IEdriver and placing it on your desktop along with the test.py file may not suffice. Ideally we should be passing the absolute path of the IEDriverServer.exe
within our code block to reduce manual configuration and be able to work with multiple versions of IEDriverServer.exe
as per your requirement as follows:
driver=webdriver.Ie(r'C:\Utility\BrowserDrivers\IEDriverServer.exe')
The error you are seeing exactly points me to the mismatch within IEDriverServer.exe
version, installed IE Browser
version and your underlying OS
version. Here either you have configured 64 bit IEDriverServer.exe
to work with 32 bit IE browser
or you have configured 32 bit IEDriverServer.exe
to work with 64 bit IE browser
. You can find some discussions on the error HRESULT 800700C1 ('%1 is
not a valid Win32 application.')
here and here.
If you are using IE 11 you may consider to set up your Test Environment as per the specification mentioned here.