Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro: Configurando webdriver para o Chrome

1) Meu test.py: ----------------------- from django.test import LiveServerTestCase from selenium import webdriver

class AnimaisTestCase(LiveServerTestCase):

def setUp(self):
    self.browser = webdriver.Chrome('c:\Octavio\Curso_Python\tdd_busca_animal\chromedriver.exe')

def tearDown(self):
    self.browser.quit()

def test_para_verificar_se_a_janela_do_browser_esta_ok(self):
    self.browser.get('https://www.alura.com.br')

2) Erro que está acontecendo: --------------------------------------------

(venv) PS C:\Octavio\Curso_Python\tdd_busca_animal> python manage.py test Creating test database for alias 'default'... System check identified no issues (0 silenced).

E

ERROR: test_para_verificar_se_a_janela_do_browser_esta_ok (setup.tests.AnimaisTestCase)

Traceback (most recent call last): File "C:\Octavio\Curso_Python\tdd_busca_animal\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start creationflags=self.creationflags) File "C:\Users\Rache\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in init restore_signals, start_new_session) File "C:\Users\Rache\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in executechild startupinfo) FileNotFoundError: [WinError 2] O sistema não pode encontrar o arquivo especificado

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Octavio\Curso_Python\tdd_busca_animal\setup\tests.py", line 9, in setUp self.browser = webdriver.Chrome('c:\Octavio\Curso_Python\tdd_busca_animal\chromedriver.exe') File "C:\Octavio\Curso_Python\tdd_busca_animal\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 72, in init service_log_path, service, keep_alive) File "C:\Octavio\Curso_Python\tdd_busca_animal\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 89, in init self.service.start() File "C:\Octavio\Curso_Python\tdd_busca_animal\venv\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home


Ran 1 test in 0.524s

FAILED (errors=1) Destroying test database for alias 'default'...

1 resposta
solução!

Inverti as barras do endereço do drive, assim funcionou:

'c:/Octavio/Curso_Python/tdd_busca_animal/chromedriver.exe'