WebDriver: Current url is blank, no page was opened - phantomjs

We are trying to add testing as part of update deployment on our live site. The tests ran fine the last time we worked on them which was a week back but now all of them throw that error. We have tried to figure it out but haven't found anything worthwhile.
Update 1: We have found that the functionality breaks due to a package getting updated. Here is the list of updated packages;
barryvdh/laravel-debugbar 2.0.6 -> 2.1.1
barryvdh/laravel-ide-helper 2.1.0 -> 2.1.2
codeception/codeception 2.1.4 -> 2.1.5
doctrine/cache 1.5.2 -> 1.6.0
laravel/framework 5.1.26 -> 5.1.28
league/flysystem 1.0.15 -> 1.0.16
maximebf/debugbar 1.10.5 -> 1.11.0
phpspec/phpspec 2.4.0 -> 2.4.1
phpunit/phpunit 4.8.20 -> 4.8.21
symfony/browser-kit 2.8.0 -> 2.8.1
symfony/class-loader 2.8.0 -> 2.8.1
symfony/console 2.7.7 -> 2.7.8
symfony/css-selector 2.7.7 -> 2.7.8
symfony/debug 2.7.7 -> 2.7.8
symfony/dom-crawler 2.7.7 -> 2.7.8
symfony/event-dispatcher 2.8.0 -> 2.8.1
symfony/finder 2.7.7 -> 2.7.8
symfony/http-foundation 2.7.7 -> 2.7.8
symfony/http-kernel 2.7.7 -> 2.7.8
symfony/polyfill-php56 1.0.0 -> 1.0.1
symfony/polyfill-util 1.0.0 -> 1.0.1
symfony/process 2.7.7 -> 2.7.8
symfony/routing 2.7.7 -> 2.7.8
symfony/translation 2.7.7 -> 2.7.8
symfony/var-dumper 2.7.7 -> 2.7.8
symfony/yaml 2.8.0 -> 3.0.1
Update 2: We have tried downgrading laravel and codeception but to no avail. It is strange as the machines which have been updated once will always throw that error even if they are downgraded till codeception 2.1.0. While the machine which passed all tests was on codeception 2.1.4 and webdriver 1.1.0.
Update 3: Installed selenium just to check and it works so maybe its phantomJS / ghost-driver which has conflict.
Example Test
public function test(AcceptanceTester $I)
{
$I->amOnUrl('http://swaggable.com');
$I->canSeeCurrentUrlEquals('/');
}
Example Output
Failed to check correct credentials in _001PlatformSignupCest::checkCorrectCredentials (tests\acceptance\_001PlatformSIgnupCest.php)
[ModuleException] WebDriver: Current url is blank, no page was opened
Scenario Steps:
3. $I->canSeeCurrentUrlEquals("/signup")
2. $I->amOnUrl("http://platform.work.com/signup")
1. $I->resizeWindow(1280,720)
Acceptance Configuration:
modules:
enabled:
- Asserts
- WebDriver:
url: http://platform.work.com
browser: firefox
http_proxy: direct
- \Helper\Acceptance
Setup:
Laravel 5.1.28
Codeception 2.1.5
PhantomJS 2.0.0
Composer
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"barryvdh/laravel-ide-helper": "^2.0",
"sboo/multiauth": "4.0.*",
"dingo/api": "0.10.*",
"doctrine/dbal": "2.3.*",
"rtconner/laravel-kint": "~2.0",
"factual/factual-php-driver": "dev-master",
"weblee/mandrill": "dev-master",
"barryvdh/laravel-debugbar": "^2.0",
"laravel/envoy": "~1.0",
"jeremeamia/superclosure": "~2.0",
"illuminate/html": "~5.0",
"predis/predis": "^1.0",
"guzzlehttp/guzzle": "~5.3|~6.0",
"laravelcollective/html": "5.1.*",
"exeu/apai-io": "dev-master",
"codeception/codeception": "*"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"fzaninotto/faker": "~1.0"
},

Hello I have the same issue.
I have downgraded the phantomjs to the 1.9.7 version
...
"jonnyw/php-phantomjs": "3.*",
"site5/phantoman": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"PhantomInstaller\\Installer::installPhantomJS",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"PhantomInstaller\\Installer::installPhantomJS",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist",
"bin-dir": "bin"
}
}
And it working now, but I know is a workaround

Related

syntax error, unexpected '#', expecting variable (T_VARIABLE) or '{' or '$'

I'am using php 7.4.27, laravel framework 8.83.7 and installed Laravel Jetstream.
Login & Register can show. After registered, Then an error notification appears in Laravel:
syntax error, unexpected '#', expecting variable (T_VARIABLE) or '{' or '$'
and in code line 12 :
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'jetstream::components.dropdown-link','data' => ['href' => $href,'#click.prevent' => $#clickPrevent]]); ?>
I won't update to php 8. What should i do?
=====edited=====
composer.json file :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/jetstream": "^2.7",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"livewire/livewire": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Explanation:
The issue comes from the fact that the compiled view version under storage/framework/views is failing to evaluate $#clickPrevent.
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'jetstream::components.dropdown-link','data' => ['href' => $href,'#click.prevent' => $#clickPrevent]]); ?>
This has nothing to do with your current PHP version.
Solution:
I managed to locally reproduce the issue. Here is how I solved it.
Steps:
Publish the Jetstream Livewire components.
Command:
php artisan vendor:publish --tag=jetstream-views
Open the file resources/views/vendor/jetstream/components/switchable-team.blade.php
In the file contents,
Instead of:
<x-dynamic-component :component="$component" href="#" #click.prevent="$root.submit();"> ❌
Use this:
<x-dynamic-component :component="$component" href="#"> ✅
Disclaimer:
Note that this is a temporary solution. Everything works fine for me. As lamented by #IMSoP in a comment, I'm afraid it may affect some unknown functionality. I've opened an issue against the library here:
switchable-team.blade.php compiled Jetstream component throwing an error: syntax error, unexpected token "#", expecting variable or "{" or "$"
Update 10th/April/2022:
Another "more stable" solution stated by #fabpl on the opened Github issue:
I think it's the same bug like [2.x] Fix parse error caused by alpine
shorthand on dynamic-component
#1032
Try to replace #click with x-on:click
https://github.com/laravel/jetstream/issues/1036#issuecomment-1094253898
Addendum:
The issue seems to have been introduced in laravel/jetstream v2.7.2. More specifically Use Alpine's #click.prevent for switching teams.
The good news is that this has been resolved beginning from laravel/jetstream v2.7.3 onwards. More specifically [2.x] Fix parse error caused by alpine shorthand on dynamic-component.
I just tagged v2.7.3 which should fix this. Thanks all 👍
https://github.com/laravel/jetstream/issues/1036#issuecomment-1094332998
Hence, you may simply just upgrade your Jetstream version to v2.7.3 to get the fix. I.e:
Command:
composer update laravel/jetstream:2.7.3
Sample Output:
PS C:\Users\Ivan\Documents\SteveContents\GITHUB\Laravel-8.83.7\laravel-8.83.7> composer update laravel/jetstream:2.7.3
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading laravel/jetstream (v2.7.2 => v2.7.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downloading laravel/jetstream (v2.7.3)
- Downloading laravel/jetstream (v2.7.3)
- Downloading laravel/jetstream (v2.7.3)
- Downloading laravel/jetstream (v2.7.3)
- Upgrading laravel/jetstream (v2.7.2 => v2.7.3): Extracting archive
...

ERROR #98123 WEBPACK: Generating development JavaScript bundle failed - unexpected token

I have cloned my repository an then install all packages via npm. When i try to start mu program with gatsby develop i get this error in all files in templates directory.
I've already cleared chache, deleted node_modules and public folders, re-install packages and so on, but nothing worked.
This is is info, which I get from gatsby info:
System:
OS: macOS 11.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU # 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.0.0 - ~/.nvm/versions/node/v14.0.0/bin/node
Yarn: 1.13.0 - ~/.npm-global/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v14.0.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 87.0.4280.141
Firefox: 78.0.2
Safari: 14.0.2
npmPackages:
gatsby: ^2.30.1 => 2.31.1
gatsby-awesome-pagination: ^0.3.6 => 0.3.6
gatsby-image: ^2.5.0 => 2.10.0
gatsby-plugin-eslint: ^2.0.8 => 2.0.8
gatsby-plugin-fontawesome-css: ^1.0.0 => 1.0.0
gatsby-plugin-manifest: ^2.6.1 => 2.11.0
gatsby-plugin-netlify-cms: ^4.5.0 => 4.9.0
gatsby-plugin-offline: ^3.4.0 => 3.9.0
gatsby-plugin-react-helmet: ^3.4.0 => 3.9.0
gatsby-plugin-sharp: ^2.8.0 => 2.13.1
gatsby-plugin-styled-components: ^3.5.0 => 3.9.0
gatsby-plugin-typography: ^2.10.0 => 2.11.0
gatsby-source-filesystem: ^2.5.0 => 2.10.0
gatsby-transformer-remark: ^2.12.0 => 2.15.0
gatsby-transformer-sharp: ^2.6.0 => 2.11.0
Does anyone have similar problem, or know how to solve it?
It's not a matter of dependencies or configuration, you have a typo in your project. It seems that somewhere in your JavaScript files (maybe in the templates folder) you have a . (dot) that is breaking your code.
To enable optional chaining in any JavaScript project, since it's not a standard feature, you need to:
Install the dependency (#babel/plugin-proposal-optional-chaining):
npm install --save-dev #babel/plugin-proposal-optional-chaining
Or:
yarn add #babel/plugin-proposal-optional-chaining --dev
Enable it in your Babel configuration. In Gatsby, you can create a babel.config.js (or .babelrc) in the root of your project to customize Babel's configuration:
{
"plugins": [
["#babel/plugin-proposal-optional-chaining"]
],
"presets": [
[
"babel-preset-gatsby",
{
"targets": {
"browsers": [">0.25%", "not dead"]
}
}
]
]
}
Fixed by:
problem was my package-lock.json. After we fixed it, everything works
properly :) nevermind

Updating from Laravel 5.8 to 6.0 fails due to dependencies

I'm trying to update from 5.8 to any version 6 Laravel. I've updated the PHP code, but the composer update is problematic for me. I've tried composer update, composer update --with-dependencies, composer install.
Composer isn't something I work with often. Any help is very appreciate! How do I decipher the composer error message to an actionable task? Is there a command that will install the dependencies for Laravel 6?
The error message after composer update:
- Conclusion: don't install laravel/framework v6.0.0
- arcanedev/support 4.5.0 requires illuminate/support ~5.8.0 -> satisfiable by laravel/framework[v5.8.38], illuminate/support[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
- arcanedev/support 4.5.0 requires illuminate/support ~5.8.0 -> satisfiable by laravel/framework[v5.8.38], illuminate/support[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
- Can only install one of: laravel/framework[6.x-dev, v5.8.38].
- don't install illuminate/support 5.8.x-dev|don't install laravel/framework 6.x-dev
- don't install illuminate/support v5.8.9|don't install laravel/framework 6.x-dev
- Installation request for laravel/framework ^6.0 -> satisfiable by laravel/framework[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.10.1, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.27, v6.18.28, v6.18.29, v6.18.3, v6.18.30, v6.18.31, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0, v6.9.0].
- Installation request for arcanedev/support ~4.5 -> satisfiable by arcanedev/support[4.5.0].
The composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"laravel/framework": "^6.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"illuminate/support": "~5.8.0|^6.0",
"intervention/image": "^2.4",
"laravel/tinker": "^1.0",
"spatie/laravel-permission": "^3.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.6",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"barryvdh/laravel-debugbar": "^3.2",
"arcanedev/log-viewer": "^4.7",
"arcanedev/support": "~4.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Just have a look at the error message you've shared: your configuration requires arcanedev/support with the version constraint ~4.5. By peeking into the version list of that package, you can see that there is only one version that can be used, which is 4.5.0, and this package requires illuminate/support with the version constraint ~5.8.0. Obviously, this excludes any later versions of Laravel.
By also updating arcanedev/support to some later version (^5.0 should be fine), you are able to update Laravel. Packagist can help you to inspect the constraints for different versions of that package.

Angular 5 build with --aot Module not found - #angular/platform-browser

I am trying to build the Angular 5 project using --aot option and the build fails with the following error,
ERROR in ../node_modules/#angular/forms/esm5/forms.js Module not
found: Error: Can't resolve '#angular/platform-browser' in '...PROJECT
LOCATION.../node_modules/#angular/forms/esm5'
Angular version
Angular CLI: 1.7.4
Node: 8.11.1
OS: darwin x64
Angular: 5.2.10
... animations, common, compiler-cli, core, http
... language-service, router
#angular/cdk: 5.2.4
#angular/cli: 1.7.4
#angular/compiler: 5.2.11
#angular/forms: 5.2.0
#angular/material-moment-adapter: 8.0.1
#angular/material: 5.2.4
#angular/platform-browser-dynamic: 5.2.0
#angular/platform-browser: 5.2.0
#angular/platform-server: 8.1.2
#angular-devkit/build-optimizer: 0.3.2
#angular-devkit/core: 0.3.2
#angular-devkit/schematics: 0.3.2
#ngtools/json-schema: 1.2.0
#ngtools/webpack: 1.10.2
#schematics/angular: 0.3.2
#schematics/package-update: 0.3.2
typescript: 2.4.2
webpack: 3.11.0
And the main.ts
import { enableProdMode } from '#angular/core';
import { platformBrowserDynamic } from '#angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
When I change it to bootstrapModule of platform-browser instead of platform-browser-dynamic build is successful but the app fails to render.
What needs to be done to compile using AOT?
Upgrade to typescript#2.6.2 will solve the issue

What is the cause of this exception .?

I am trying to run Behat\mink using this code "bin\behat --format html --out report.html --profile firefox" . But i am getting this error .
[RuntimeException]
MinkExtension 1.3 only supports Goutte 1.x for MinkGoutteDriver, not Goutte 2.x.
composer.json looks like this
{
"require": {
"behat/behat": "2.5.*#stable",
"behat/mink": "1.6.*#stable",
"behat/mink-extension": "*",
"behat/mink":"~1.5#dev",
"behat/mink":"~1.6#dev",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
behat.yml
firefox:
context:
parameters:
Browser_Name: firefox
extensions:
Behat\MinkExtension\Extension:
base_url: https://google.com
javascript_session: selenium2
browser_name: firefox
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
It would be so helpful if you could tell me where i have gone wrong .
I would say that your first problem lies within your composer.json file. It would appear as though you are attempting to load both developmental and stable versions of the same library.
Unless you are attempting to test / load some dev code you can simplify your require section to:
"require": {
"behat/mink-selenium2-driver" : "~1.2",
"behat/mink-goutte-driver" : "~1.1",
"behat/mink-extension" : "~2.0"
}
Your behat/behat, and behat/mink libraries will automatically be pulled in by composer to fulfil the requirements for those libraries.
Information on the tilde operator, within your composer.json file can be found within composers documentation
Again, unless you are using dev based releases you might want to look at omitting:
"minimum-stability": "dev",