dbrekelmans / browser-driver-installer Goto Github PK
View Code? Open in Web Editor NEWHelps you install the appropriate browser driver
License: MIT License
Helps you install the appropriate browser driver
License: MIT License
When creating a release, dbrekelmans/bdi
commits the correct files, but creates a release from the wrong commit.
Since upgrading from PHP 8.0 to 8.1.1, I get the following:
./vendor/bin/bdi detect drivers -vvv
Box Requirements Checker
========================
> Using PHP 8.1.1
> PHP is using the following php.ini file:
/etc/php/8.1/cli/php.ini
> Checking Box requirements:
✔ The application requires the version "^7.2|^8.0" or greater.
✔ The application requires the extension "json".
✔ The package "myclabs/php-enum" requires the extension "json".
✔ The application requires the extension "zip".
✔ The application requires the extension "zlib".
[OK] Your system is ready to run the application.
Found google-chrome 97.0.4692.71.
[WARNING] Could not execute command "browser:google-chrome".
Something went wrong getting the driver version from the chromedriver API.
[WARNING] Could not execute command "browser:chromium".
Version could not be determined.
Found firefox 96.0.
[WARNING] Could not execute command "browser:firefox".
fopen(): Invalid IP Address: 0
The commands ./vendor/bin/bdi driver:chromedriver
and ./vendor/bin/bdi driver:geckodriver
produce the following:
In ErrorChunk.php line 65:
fopen(): Invalid IP Address: 0
In NativeResponse.php line 120:
fopen(): Invalid IP Address: 0
All my PHPUnit tests still are successful, so I doubt that it's my PHP installation that's faulty.
Add a driver:chrome
command to install chrome driver directly (without checking for compatible browser version).
With required argument version
that either specifies a version string (x.x.x
) or latest
Depends on #37.
With gecko driver supported, we can build in support for firefox.
Since symfony/panther
supports PHP 7.1, we are also required to support it in order for panther to be able to require this library.
Hello, not sure if it's a issue with this library but chromedriver 100 is not being automatically download with bdi detect
. I had to download manually from https://chromedriver.chromium.org/downloads.
Implement https://github.com/Roave/BackwardCompatibilityCheck in CI
In order to support Chromium, a few things need to happen:
src/Browser/Chromium/PathResolver
src/Browser/Chromium/VersionResolver
install.php
install.php
Chromium can work with the already existing ChromeDriver.
As an example, you can look at how GoogleChrome is implemented.
We want to run all available commands on all supported operating systems.
Originally posted by mkrizanec-undabot December 29, 2022
@dbrekelmans
Hello, are you planning to update this library to work with PHP 8.1?
Specificaly, I'm using it with Panther and detect drivers method doesn't work anymore.
**Deprecated: Return type of HumbugBox385\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///opt/app/vendor/dbrekelmans/bdi/bdi/.box/src/RequirementCollection.php on line 15
Deprecated: Return type of HumbugBox385\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///opt/app/vendor/dbrekelmans/bdi/bdi/.box/src/RequirementCollection.php on line 19
Deprecated: Return type of MyCLabs\Enum\Enum::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///opt/app/vendor/dbrekelmans/bdi/bdi/vendor/myclabs/php-enum/src/Enum.php on line 246**
A lot of projects still run on php versions lower than 7.4. Let's enable them to use this tool by supporting at least 7.2. Most likely the only change will be typed properties -> docblocks.
We want to run vendor/bin/phpunit
via github action for every PR.
While testing around i noticed that running the bdi driver:chrome
ended up installing version 114.0.5735.90
.
The api endpoint that is called for finding the last version (https://chromedriver.storage.googleapis.com/LATEST_RELEASE
) seems to have stopped updating when they migrated to the new json endpoints.
We can now resolve the latest stable version though https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json
.
From a quick search it looks like this is possible with a combination of:
The PHAR can be built by humbug/box
with the command box build
.
This means humbug/box
needs to be available in the github action.
The command bdi browser:google-chrome
is not working on windows.
In Version.php line 41:
[InvalidArgumentException]
Could not parse version string "��
\
\
\
\".
Exception trace:
at D:\a\browser-driver-installer\browser-driver-installer\src\Version.php:41
DBrekelmans\BrowserDriverInstaller\Version::fromString() at D:\a\browser-driver-installer\browser-driver-installer\src\Browser\GoogleChrome\VersionResolver.php:58
DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome\VersionResolver->getVersionFromCommandLine() at D:\a\browser-driver-installer\browser-driver-installer\src\Browser\GoogleChrome\VersionResolver.php:33
DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome\VersionResolver->from() at D:\a\browser-driver-installer\browser-driver-installer\src\Browser\BrowserFactory.php:36
DBrekelmans\BrowserDriverInstaller\Browser\BrowserFactory->createFromNameOperatingSystemAndPath() at D:\a\browser-driver-installer\browser-driver-installer\src\Browser\BrowserFactory.php:27
DBrekelmans\BrowserDriverInstaller\Browser\BrowserFactory->createFromNameAndOperatingSystem() at D:\a\browser-driver-installer\browser-driver-installer\src\Command\BrowserCommand.php:72
DBrekelmans\BrowserDriverInstaller\Command\BrowserCommand->execute() at D:\a\browser-driver-installer\browser-driver-installer\vendor\symfony\console\Command\Command.php:258
Symfony\Component\Console\Command\Command->run() at D:\a\browser-driver-installer\browser-driver-installer\vendor\symfony\console\Application.php:920
Symfony\Component\Console\Application->doRunCommand() at D:\a\browser-driver-installer\browser-driver-installer\vendor\symfony\console\Application.php:266
Symfony\Component\Console\Application->doRun() at D:\a\browser-driver-installer\browser-driver-installer\vendor\symfony\console\Application.php:142
Symfony\Component\Console\Application->run() at D:\a\browser-driver-installer\browser-driver-installer\bdi:42
The delivery process for chrome has changed
https://chromedriver.chromium.org/
More info:
It could be nice to install all drivers for all installed browsers by default (php install
). It would help, at least with Panther, to run the same test suite with different browsers.
Also, maybe can the command name be a bit more explicit? Such as php vendor/bin/install-browser-drivers
?
Hello,
I just ran into an issue : chromedriver 109+ now contains a license file in the zip :
(i.ie. : https://chromedriver.storage.googleapis.com/109.0.5414.74/chromedriver_linux64.zip)
BDI fails if more than one file is contained in the zip.
Error message :
In Downloader.php line 72:
Something went wrong extracting the chromedriver archive.
In Downloader.php line 175:
Expected exactly one file in the archive. Found 2
browser:google-chrome [--os OS] [--browser-path BROWSER-PATH] [--] [<install-path>]
Could we extract the only file named "chromedriver" ? Or is there an edge case (pun intended)?
Gecko driver support is required to support Mozilla Firefox.
(the point)
Am using 7.2 on legacy project and 1.0.7 of bdi is not working because phar contains code with ??= operators
I haven't looked too much into this, but I suppose it should be possible to support Microsoft Edge with https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
The Downloader for the ChromeDriver
uses https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing
as endpoint for the downloads.
Google seems to have changed this domain to https://storage.googleapis.com/chrome-for-testing-public/
.
A quick fix would be to just change the download endpoint. But possibly we should look into the option to resolve the download url, from the page we use to resolve the versions?
Edit:
This change seems to have been made between patches 121.0.6166
and 121.0.6167
FROM php:8.1-alpine
WORKDIR /app
RUN apk add libzip-dev $PHPIZE_DEPS
RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN docker-php-ext-install bcmath zip
COPY --from=phpbuild /app/vendor /app/vendor
COPY --from=jsbuild /app/public/build /app/public/build
# Chromium and ChromeDriver
ENV PANTHER_NO_SANDBOX 1
# Not mandatory, but recommended
ENV PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage'
RUN apk add --no-cache chromium
CMD tail -f /dev/null
Browser will be installed as chromium-browser
not chromium
.
Adding ln -s $(which chromium-browser) /usr/bin/chromium
after install fixes the issue
We want to run vendor/bin/psalm` via github action for every PR.
Currently the command bdi driver:<driver-name>
requires you to pass an install path. To make installation easier, let's use .
as the default install path.
Currently, there is no way (AFAIK) to set where the drivers will be installed.
It's not even consistent across commands, for example on my machine:
vendor/bin/bdi detect drivers
[OK] geckodriver 0.33.0 installed to drivers\geckodriver.exe
But this installs it on the project root:
vendor/bin/bdi driver:chromedriver
[OK] chromedriver 114.0.5735.90 installed to .\chromedriver.exe
It would be useful to have the possibility to read a .env variable with the path, for example one may want tests/drivers/
We need unit tests for:
DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome\PathResolver
DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome\VersionResolver
Github releases
To distribute phars via Github in a PHIVE compliant way, it needs to be made available as an attachment to a release - alongside with a valid gpg signature. For PHIVE to pick it up, the filenames need to end on ".phar" and ".phar.asc" respectively.
See:
Many CI runs fail, because of the RateLimit for GitHub API.
Maybe someone can help with this problem.
HTTP/1.1 403 rate limit exceeded returned for "https://api.github.com/repos
/mozilla/geckodriver/releases/latest".
PHP 7.x is no longer supported: https://www.php.net/supported-versions.php
Usage of BDI on 7.4 is still quite high, so keeping support for that: https://packagist.org/packages/dbrekelmans/bdi/php-stats
We need unit tests for:
DBrekelmans\BrowserDriverInstaller\Driver\ChromeDriver\Downloader
DBrekelmans\BrowserDriverInstaller\Driver\ChromeDriver\VersionResolver
I'm getting the following error when I run vendor/bin/bdi detect drivers
immediately after composer require --dev dbrekelmans/bdi
. The installation of the package runs successfully, but detect drivers
crashes with this message:
Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, bool given in phar:///vendor/dbrekelmans/bdi/bdi/.box
/src/Terminal.php:60
Stack trace:
#0 phar:///vendor/dbrekelmans/bdi/bdi/.box/src/Terminal.php(60): trim(false)
#1 phar:///vendor/dbrekelmans/bdi/bdi/.box/src/Terminal.php(31): HumbugBox436\KevinGH\RequirementChecker\Terminal::initDimensions()
#2 phar:///vendor/dbrekelmans/bdi/bdi/.box/src/Printer.php(28): HumbugBox436\KevinGH\RequirementChecker\Terminal->getWidth()
#3 phar:///vendor/dbrekelmans/bdi/bdi/.box/src/Checker.php(17): HumbugBox436\KevinGH\RequirementChecker\Printer->__construct(32, true)
#4 phar:///vendor/dbrekelmans/bdi/bdi/.box/bin/check-requirements.php(22): HumbugBox436\KevinGH\RequirementChecker\Checker::checkRequirement
s()
#5 F:\Office\Amro Suboh\Codraft\Codraft\back\vendor\dbrekelmans\bdi\bdi(12): require('phar://F:/Offic...')
#6 F:\Office\Amro Suboh\Codraft\Codraft\back\vendor\bin\bdi(120): include('F:\\Office\\Amro ...')
#7 {main}
thrown in phar:///vendor/dbrekelmans/bdi/bdi/.box/src/Terminal.php on line 60
I'm using PHP 8.2 on XAMPP and Windows 11. This is a Laravel 10 project if that has anything to do. I'm using latest version (1.0.5) of this package.
Add a TokenRegistry where we can set a github token via the commands. The commands would receive this token as a command option. In the Downloader and VersionResolver, we can use the token from the registry (if it is set) to do the API calls. The TokenRegistry would be injected into the Downloader and VersionResolver via DI.
Since v1.0.5 I encountered this error on MacOs and Docker (Linux alpine image)
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.30. in phar:///..../.composer/vendor/dbrekelmans/bdi/bdi/vendor/composer/platform_check.php on line 24
Here is the detailed output :
# composer global exec bdi -vvv
> __exec_command: bdi
Executing command (CWD): bdi
Box Requirements Checker
========================
> Using PHP 8.0.30
> PHP is using the following php.ini file:
/usr/local/etc/php/8.0/php.ini
> Checking Box requirements:
✔ The application requires a version matching "^7.2|^8.0".
✔ The application requires the extension "json".
✔ The package "myclabs/php-enum" requires the extension "json".
✔ The application requires the extension "zip".
✔ The application requires the extension "zlib".
✔ The package "symfony/service-contracts" conflicts with the extension "psr".
[OK] Your system is ready to run the application.
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.30. in phar:///Users/prometee/.composer/vendor/dbrekelmans/bdi/bdi/vendor/composer/platform_check.php on line 24
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.30. in phar:///Users/prometee/.composer/vendor/dbrekelmans/bdi/bdi/vendor/composer/platform_check.php on line 24
Script bdi handling the __exec_command event returned with error code 255
Using the v1.0.4 no issue encountered.
We want to run vendor/bin/phpcs
via github action for every PR.
Mac ARM now has its own chromedriver binary in chromedriver_mac_arm64.zip
. The easiest way to support this is to add MacARM
as a new operating system
There is an api endpoint https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json
that lists the url from which a specific version can be downloaded.
It would be a nice improvement to base the download url, on the response from the api. Instead of hard coded download url's, as those are more prone to failure, whenever they decide to change it again. (Like what happened last thursday, but they quickly fixed in the same day)
Currently, the chrome version is resolved based on some registry keys. This does not take into account the installed path and will cause incorrect versions if the user specifies custom browser path via the command.
The version resolver should work based on the provided path, instead of independently.
We want to run vendor/bin/phpstan analyse
via github action for every PR.
Hello, I'm having trouble getting started and could use some help. I suspect that the problem is related to my environment, which is inside a ddev container.
Here are the setup commands I'm running in Windows WSL2 to start the environment:
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev start
Then I install and run bdi:
ddev composer require --dev dbrekelmans/bdi
ddev exec vendor/bin/bdi detect drivers -vvv
And that's when I get the errors:
Box Requirements Checker
========================
> Using PHP 8.0.26
> PHP is using the following php.ini file:
/etc/php/8.0/cli/php.ini
> Checking Box requirements:
✔ The application requires the version "^7.2|^8.0" or greater.
✔ The application requires the extension "json".
✔ The package "myclabs/php-enum" requires the extension "json".
✔ The application requires the extension "zip".
✔ The application requires the extension "zlib".
[OK] Your system is ready to run the application.
[WARNING] Could not execute command "browser:google-chrome".
Command google-chrome --version failed
[WARNING] Could not execute command "browser:chromium".
Version could not be determined.
[WARNING] Could not execute command "browser:firefox".
Command firefox --version failed
Here are my PHP/Composer versions in case it is helpful:
$ ddev exec php --version
PHP 8.0.26 (cli) (built: Dec 5 2022 21:59:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.26, Copyright (c) Zend Technologies
with Zend OPcache v8.0.26, Copyright (c), by Zend Technologies
$ ddev composer --version
Composer version 2.5.4 2023-02-15 13:10:06
Please let me know if there's anything else I can provide that might help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.