laravel / dusk

Laravel Dusk provides simple end-to-end testing and browser automation.
https://laravel.com/docs/dusk
MIT License
1.88k stars 324 forks source link

Chrome failed to start on Windows 10 #215

Closed feryardiant closed 6 years ago

feryardiant commented 7 years ago

First of all, everything is works just fine on my Elementary OS Loki (Ubuntu 16.04) machine but not on Windows 10 machine.

What happen?

When I run php artisan dusk I got this

> php artisan dusk
PHPUnit 5.7.19 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 2.03 seconds, Memory: 10.00MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownServerException: unknown error: chrome failed to start
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.15063 x86_64)

D:\Workspaces\personal\project\vendor\facebook\webdriver\lib\Exception\WebDriverException.php:114
D:\Workspaces\personal\project\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:320
D:\Workspaces\personal\project\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
D:\Workspaces\personal\project\tests\DuskTestCase.php:32
D:\Workspaces\personal\project\vendor\laravel\dusk\src\TestCase.php:208
D:\Workspaces\personal\project\vendor\laravel\framework\src\Illuminate\Support\helpers.php:652
D:\Workspaces\personal\project\vendor\laravel\dusk\src\TestCase.php:209
D:\Workspaces\personal\project\vendor\laravel\dusk\src\TestCase.php:115
D:\Workspaces\personal\project\vendor\laravel\dusk\src\TestCase.php:87
D:\Workspaces\personal\project\tests\Browser\ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Steps to reproduce

  1. Create new laravel project composer create-project laravel/laravel:5.4 project and cd project
  2. Install Dusk composer require -D laravel/dusk
  3. Register DuskServiceProvider to config/app.php
  4. Install dusk for current project php artisan dusk:install
  5. Run laravel dusk php artisak dusk

Is it a bug? or anyone have solution for this issue?

Thank you.

deleugpn commented 7 years ago

Confirm you have the latest version of chrome installed and accessible by chromedriver. Make sure chromedriver-win.exe is executable (no permission issues) Check if chrome.exe is in the system path (e.g Win + R type chrome and run) If all that works, try to run the driver manually with output logs on (--verbose).

Information on #55 #71 and #98 might help you as well.

feryardiant commented 7 years ago

Confirm you have the latest version of chrome installed and accessible by chromedriver.

Yes, Installed Chrome 57.0.2987.133 & Chrome Canary 59.0.3066.0, none is working

Make sure chromedriver-win.exe is executable (no permission issues)

Yes, no permission issue whatsoever

Check if chrome.exe is in the system path (e.g Win + R type chrome and run)

I've try to add Chrome & Chrome Canary install dir to PATH & yet can be executed from CMD/Powershell but still no luck even.

note: I'm adding one of them not both.

If all that works, try to run the driver manually with output logs on (--verbose).

> php artisan dusk --verbose
PHPUnit 5.7.19 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.2 with Xdebug 2.5.1
Configuration: D:\Workspaces\personal\codes\laravel-project\phpunit.dusk.xml

E                                                                   1 / 1 (100%)

Time: 2.14 seconds, Memory: 14.00MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownServerException: unknown error: chrome failed to start
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.15063 x86_64)

D:\Workspaces\personal\codes\laravel-project\vendor\facebook\webdriver\lib\Exception\WebDriverException.php:114
D:\Workspaces\personal\codes\laravel-project\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:320
D:\Workspaces\personal\codes\laravel-project\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
D:\Workspaces\personal\codes\laravel-project\tests\BrowserTestCase.php:73
D:\Workspaces\personal\codes\laravel-project\vendor\laravel\dusk\src\TestCase.php:208
D:\Workspaces\personal\codes\laravel-project\vendor\laravel\framework\src\Illuminate\Support\helpers.php:652
D:\Workspaces\personal\codes\laravel-project\vendor\laravel\dusk\src\TestCase.php:209
D:\Workspaces\personal\codes\laravel-project\vendor\laravel\dusk\src\TestCase.php:115
D:\Workspaces\personal\codes\laravel-project\vendor\laravel\dusk\src\TestCase.php:87
D:\Workspaces\personal\codes\laravel-project\tests\Browser\ExampleTest.php:15

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Quick question, how to make sure is it accessible by chromedriver or not?

deleugpn commented 7 years ago

The --verbose argument is to be given to the chromedriver. Open your DuskTestCase and comment out the lines that start the chromedriver.

        // return RemoteWebDriver::create(
       //     'http://localhost:9515', DesiredCapabilities::chrome()
       //  );

Then, run the chromedriver manually (./vendor/laravel/dusk/bin/chromedriver-win.exe --verbose) and then run dusk normally and watch the window that you ran chromedriver manually.

feryardiant commented 7 years ago

The only line I need to comment out is here become:

public static function prepare()
{
    // static::startChromeDriver();
}

Not that you've mentioned and here the output from chromedriver-win.exe --verbose

.\vendor\laravel\dusk\bin\chromedriver-win.exe --verbose
Starting ChromeDriver 2.28.455520 (cc17746adff54984afff480136733114c6b3704b) on port 9515
Only local connections are allowed.
[4.421][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "project": "Laravel Project"
   }
}
[4.424][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[4.425][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[4.445][INFO]: Launching chrome: "C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_14027\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12995 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_30701" data:,
[4.468][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[4.468][DEBUG]: Log type 'driver' lost 0 entries on destruction
[4.469][DEBUG]: Log type 'browser' lost 0 entries on destruction
[4.733][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "project": "Laravel Project"
   }
}
[4.734][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[4.739][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[4.753][INFO]: Launching chrome: "C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_17329\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12946 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_22103" data:,
[4.769][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[4.769][DEBUG]: Log type 'driver' lost 0 entries on destruction
[4.771][DEBUG]: Log type 'browser' lost 0 entries on destruction
[5.023][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "project": "Laravel Project"
   }
}
[5.025][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[5.029][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[5.035][INFO]: Launching chrome: "C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_30591\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12979 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_19560" data:,
[5.046][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[5.046][DEBUG]: Log type 'driver' lost 0 entries on destruction
[5.048][DEBUG]: Log type 'browser' lost 0 entries on destruction
[5.300][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "project": "Laravel Project"
   }
}
[5.301][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[5.304][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[5.316][INFO]: Launching chrome: "C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_16502\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12598 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_31858" data:,
[5.325][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[5.325][DEBUG]: Log type 'driver' lost 0 entries on destruction
[5.325][DEBUG]: Log type 'browser' lost 0 entries on destruction
[5.580][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "project": "Laravel Project"
   }
}
[5.581][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[5.584][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[5.591][INFO]: Launching chrome: "C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_10111\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12379 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_4594" data:,
[5.604][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[5.604][DEBUG]: Log type 'driver' lost 0 entries on destruction
[5.605][DEBUG]: Log type 'browser' lost 0 entries on destruction

As mentioned in the output above, I tried to run command bellow on my powershell

> C:\Users\feryardiant\AppData\Local\Google\Chrome\Application\chrome.exe --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --ignore-certificate-errors --load-component-extension="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_14027\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12995 --safebrowsing-disable-auto-update--test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_30701" data:

The browser is opened with this popup

image

image

deleugpn commented 7 years ago

Seems like your installation is corrupted.

feryardiant commented 7 years ago

Did you mean my chromedriver installation?

deleugpn commented 7 years ago

No, the Google Chrome installation.

feryardiant commented 7 years ago

Sorry but, how could you say my Chrome installation is corrupted while I am still using it for work with no problem?

deleugpn commented 7 years ago

http://stackoverflow.com/questions/12533661/chrome-says-my-extensions-manifest-file-is-missing-or-unreadable

I'm basically saying the problem is not with Dusk nor with Chromedriver (which ships with Dusk). The problem is your browser installation. Whether it still works for you as a direct user of the application, that's somewhat irrelevant to judge whether the application (e.g. Google Chrome) is fully working.

feryardiant commented 7 years ago

Well, I've tried to remove completely my Chrome installation and re-install it back. I noticed that the data path (which is C:\Users\FERYAR~1\AppData\Local\Temp\scoped_dir12892_14027) is created only when chromedriver is started & I can't find the internal directory as shown in error popup (where the place is manifest.json belongs) I thought that's why the driver could not find the manifest.json.

driesvints commented 6 years ago

Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.

StephanMeijer commented 4 years ago

Still experiencing this issue.