1

OS: Win10
Python: venv 3.8
Chrome: 95.0.4638.69
ChromeDriver: 95.0.4638.69
Selenium: 4.0.0

Trying to run simple tests:

import os
import unittest
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By


class SmokeTests(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        chromedriver_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), r"libs\chromedriver.exe")
        ser = Service(chromedriver_path)
        self.driver = webdriver.Chrome(service=ser)
        base_url = 'https://google.com/'
        self.driver.get(base_url)

    @classmethod
    def tearDownClass(self):
        self.driver.quit()

    def test_name_in_tab_title(self):
        expected_tab_title = 'Google'
        observed_tab_title = self.driver.title
        self.assertEqual(expected_tab_title, observed_tab_title)

Test was working day before and when I started again my machine I got error:

----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Projects\tests\smoke_tests.py", line 13, in setUpClass
    self.driver = webdriver.Chrome(service=ser)
  File "C:\Projects\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "C:\Projects\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
    self.service.start()
  File "C:\Projects\venv\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

----------------------------------------------------------------------
Ran 0 tests in 0.003s

FAILED (errors=1)

Plain Python code execution works ok.

pbaranski
  • 22,778
  • 19
  • 100
  • 117

1 Answers1

0

Deleting and adding again chromedriver.exe fixed problem.

pbaranski
  • 22,778
  • 19
  • 100
  • 117