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

Dusk 7.9.0 \ chromedriver.exe path not found #1044

Closed
Buroob opened this issue Jul 26, 2023 · 11 comments · Fixed by #1045
Closed

Dusk 7.9.0 \ chromedriver.exe path not found #1044

Buroob opened this issue Jul 26, 2023 · 11 comments · Fixed by #1045

Comments

@Buroob
Copy link

Buroob commented Jul 26, 2023

Dusk Version

7.9.0

Laravel Version

10.16.1

PHP Version

8.2.3

PHPUnit Version

10.2.6

Database Driver & Version

No response

Description

Hello,

I'm on windows 11.
I have ugraded my project to the last version (7.9.0) of Dusk (ok on 7.8.0).
When I launch the command dusk:chrome-driver I have this error :

D:\sites\myapp>php artisan dusk:chrome-driver

   ErrorException

  rename(D:\sites\myapp\vendor\laravel\dusk\src\Console/../../bin/chromedriver-win32/chromedriver.exe,D:\sites\myapp\vendor\laravel\dusk\src\Console/../../bin/chromedriver-win-win32/chromedriver-win.exe): Le chemin d’accès spécifié est introuvable (code: 3)

  at vendor\laravel\dusk\src\Console\ChromeDriverCommand.php:242
    238▕         $newName = Str::contains($binary, DIRECTORY_SEPARATOR)
    239▕             ? Str::after(str_replace('chromedriver', 'chromedriver-'.$os, $binary), DIRECTORY_SEPARATOR)
    240▕             : str_replace('chromedriver', 'chromedriver-'.$os, $binary);
    241▕
  ➜ 242▕         rename($this->directory.$binary, $this->directory.$newName);
    243▕
    244▕         chmod($this->directory.$newName, 0755);
    245▕     }
    246▕

  1   vendor\laravel\dusk\src\Console\ChromeDriverCommand.php:242

  2   vendor\laravel\dusk\src\Console\ChromeDriverCommand.php:98
      Laravel\Dusk\Console\ChromeDriverCommand::rename("chromedriver-win32/chromedriver.exe", "win")

How can I resolved this issue please ?

Thanks for your help.

Steps To Reproduce

On Windows 11 : php artisan dusk:chrome-driver

@crynobone
Copy link
Member

Hi there,

Can you provide the current Chrome version installed? e.g:

image

@alex3162
Copy link

Something is going wrong with the renaming - it is not finding the directory separator, or it is finding more than one separator. So it expects the directory to be chromedriver-win-win32. I'm on a mac so it all works fine for me. Maybe replace line 239 of Console\ChromeDriverCommand.php with Str::afterLast?

@crynobone
Copy link
Member

Before we do that, can we replicate the issue first? which means knowing the installed Chrome version.

I don't have Windows running at the moment but running php artisan dusk:chrome-driver --all works fine for Chrome 115

@alex3162
Copy link

alex3162 commented Jul 27, 2023

My colleague had the same issue last night with version 115. He had to manually rename the file to get the dusk tests to work. He was running Windows.

@crynobone
Copy link
Member

@alex3162 Can you share the value of $binary on line 238?

@alex3162
Copy link

I'm on a mac and I don't have the issue. I'll be able to get back to you soon - Waiting for my colleague to get off a call....

@alex3162
Copy link

The binary is chromedriver-win32/chromedriver.exe

But the directory separator for windows is \.

If you look at @Buroob's error message, there is a mix of / and \ in the path because it it getting it from the zip file.

@crynobone
Copy link
Member

@alex3162 Can you ask your colleague to test out the changes in this PR: https://github.com/laravel/dusk/pull/1045/files

@alex3162
Copy link

Yep - It works

taylorotwell pushed a commit that referenced this issue Jul 27, 2023
@driesvints
Copy link
Member

Released now 👍

@Buroob
Copy link
Author

Buroob commented Jul 27, 2023

Thanks a lot. 😄
It's working fine now 👍

ChromeDriver binary successfully installed for version 115.0.5790.102. 

Kayrah87 pushed a commit to Kayrah87/legacy-dusk that referenced this issue Jul 28, 2023
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

Successfully merging a pull request may close this issue.

4 participants