symfony / panther

A browser testing and web crawling library for PHP and Symfony
MIT License
2.94k stars 222 forks source link

Cannot launch tests using panther getting runtime exception #475

Open theTestingApproach opened 3 years ago

theTestingApproach commented 3 years ago

Hello,

I have just started learning panther but getting this issue when launching the tests:

Symfony\Component\Process\Exception\RuntimeException: The provided cwd "/home/anuradha/Documents/Projects/panther/vendor/symfony/panther/src/../../../../public" does not exist.

/home/anuradha/Documents/Projects/panther/vendor/symfony/process/Process.php:344 /home/anuradha/Documents/Projects/panther/vendor/symfony/panther/src/ProcessManager/WebServerManager.php:80 /home/anuradha/Documents/Projects/panther/vendor/symfony/panther/src/PantherTestCaseTrait.php:135 /home/anuradha/Documents/Projects/panther/vendor/symfony/panther/src/PantherTestCaseTrait.php:164 /home/anuradha/Documents/Projects/panther/src/Features/Browser/OpenBrowserTest.php:14

Someone said to add some config in the projects root document here: https://github.com/symfony/panther/issues/152

Can someone please guide me where this is actually?

This is my code below which i am trying to launch..

<?php

namespace E2E\Features\Browser;

use Symfony\Component\Panther\PantherTestCase; use Symfony\Component\Panther\WebTestCase; use Symfony\Component\Panther\Client; use PHPUnit\Framework\TestCase; class OpenBrowserTest extends PantherTestCase{

public function testBrowserOpen(): void{
    $client = self::createPantherClient(); // Your app is automatically started using the built-in web server
    $client->request('GET', 'www.xxx.com');//This is an example url
}

}

Thank you

Mepcuk commented 3 years ago

You foggoten install drivers for Chrome.

`Installing ChromeDriver and geckodriver Panther uses the WebDriver protocol to control the browser used to crawl websites.

On all systems, you can use dbrekelmans/browser-driver-installer to install ChromeDriver and geckodriver locally:

composer require --dev dbrekelmans/bdi vendor/bin/bdi detect drivers Panther will detect and use automatically drivers stored in the drivers/ directory.

Alternatively, you can use the package manager of your operating system to install them.

On Ubuntu, run:

apt-get install chromium-chromedriver firefox-geckodriver On Mac, using Homebrew:

brew install chromedriver geckodriver On Windows, using chocolatey:

choco install chromedriver selenium-gecko-driver Finally, you can download manually ChromeDriver (for Chromium or Chrome) and GeckoDriver (for Firefox) and put them anywhere in your PATH or in the drivers/ directory of your project.`

Mepcuk commented 3 years ago

https://github.com/symfony/panther

theTestingApproach commented 3 years ago

Hi @Mepcuk , I have tried them but still getting the same issues: image

Mepcuk commented 3 years ago

@theTestingApproach what Client do you use ? Curl ? Chrome?

theTestingApproach commented 3 years ago

I use panther client: This is my code..I am just trying to open the site and its failing already

<?php

namespace E2E\Features\Browser;

use Symfony\Component\Panther\PantherTestCase;
use Symfony\Component\Panther\WebTestCase;
use Symfony\Component\Panther\Client;
use PHPUnit\Framework\TestCase;
class OpenBrowserTest extends PantherTestCase{

    public function testBrowserOpen(): void{
        $client = self::createPantherClient(); 
        $client->request('GET', 'www.xxx.com');//This is an example url
    }
}
theTestingApproach commented 3 years ago

Hello, Is there anything i can try pls? Tried to setup everything again got the same issue. Thanks

joe94113 commented 2 years ago

same problem