Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [WinError 193] %1 is not a valid Win32 application #671

Closed
raylabres opened this issue Jul 30, 2024 · 5 comments
Closed

OSError: [WinError 193] %1 is not a valid Win32 application #671

raylabres opened this issue Jul 30, 2024 · 5 comments

Comments

@raylabres
Copy link

Function executed:
def define_browser(site, show_browser, name_browser="chrome"): if show_browser == False: if name_browser.lower() == "chrome": options = OptionChrome() options.add_argument('--headless') service = Service(ChromeDriverManager().install()) browser = webdriver.Chrome(service=service, options=options) else: options = OptionEdge() options.add_argument('--headless') service = Service(EdgeChromiumDriverManager() .install()) browser = webdriver.Edge(service=service, options=options) else: if browser_name.lower() == "chrome": service = Service(ChromeDriverManager().install()) browser = webdriver.Chrome(service=service)

else:
service = Service(EdgeChromiumDriverManager().install())
browser = webdriver.Edge(service=service)

browser.get(site)
browser.maximize_window()
sleep(2)
return browser

Error returned:
Traceback (most recent call last):
File "c:\Development\Functions.py", line 296, in
browser= define_browser(site_url, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Development\Functions.py", line 156, in define_browser
browser = webdriver.Chrome(service=service)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in init super().init( File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chromium\webdriver.py" \selenium\webdriver\common\service.py", line 98, in start self._start_process(self._path) File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\service.py", line 208, in _start_process self.process = subprocess.Popen(
^^^^^^^^^^^^^^^^ File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\AppData\Local\Programs\Python\Py thon312\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [WinError 193] %1 is not an application Valid Win32

@ahmad-a-radwan07
Copy link

same issue here

@jfitzpatrick6
Copy link

I was able to resolve this by removing service = service. It appears the new update has removed the need for service.

https://stackoverflow.com/questions/78793171/webdriver-error-when-using-selenium-error-oserror-winerror-193-1-is-not-a-v

driver = webdriver.Chrome(options=options)

Though I'm using chrome. I've seen it mentioned on other issues.

@eduardorco
Copy link

Same here. Following @jfitzpatrick6 solution worked!

@jacsonrsasse
Copy link

Yep, same here. @jfitzpatrick6 solution worked for me too!

@raylabres
Copy link
Author

Great! Here the solution, it worked!

Vinyzu added a commit to Kaliiiiiiiiii-Vinyzu/CDP-Patches that referenced this issue Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants