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

Unable to run even a basic test #605

Open
aruku opened this issue Sep 27, 2023 · 2 comments
Open

Unable to run even a basic test #605

aruku opened this issue Sep 27, 2023 · 2 comments

Comments

@aruku
Copy link

aruku commented Sep 27, 2023

I've been fighting with Panther and Selenium for two or three days on and off at this point, and so far they both keep eluding me.
I've given up on using Selenium Grid to use a remote browser and I just want to get the basic testing example to work.
I'm using the provided Dockerfile through Compose so I can specify the same network as the rest of my project; I have also changed PANTHER_NO_SANDBOX to false.
Then, for the test, I made the following modifications trying to understand what arguments, options and capabilities are needed:

    public function testMyApp(): void
    {
//        dd($_SERVER);

        $arguments = ['--headless', '--window-size=1200,1100', '--disable-gpu'];
        $options = [
            'scheme' => 'https',
            'host' => 'NAME',
            'path' => '/',
            'chromedriver_arguments' => [],
            'capabilities' => ['acceptInsecureCerts' => true],
            'external_base_uri' => 'NAME',
        ];
        $client = Client::createChromeClient('/usr/bin/chromedriver', $arguments, $options, 'NAME'); // Your app is automatically started using the built-in web server
        $client->request('GET', '/');

        [...]

I get this error:

1) App\Tests\E2E\pantherTest::testMyApp
RuntimeException: Could not connect to chrome after 30 seconds (OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to NAME:9515  for "https://NAME:9515/".).

I have replaced the actual local name for NAME in these snippets.
Before it times out, I can see the panther and chromedriver processes spawning, but that is as far as I get.
What I'm doing wrong?

Any feedback would be greatly appreciated.

@halfer
Copy link
Contributor

halfer commented Sep 30, 2023

I wonder if you need to use Client::createSeleniumClient()? I would guess that the browser-specific static methods are for the WebDriver implementation, not Selenium.

@halfer
Copy link
Contributor

halfer commented Sep 30, 2023

FWIW, I have set up a remote Geckodriver instance (instrumentisto/geckodriver) instead of Selenium and that seems to work well. However Panther had to rather be hacked to get it to work:

  • I use a custom FirefoxManager as I needed it not to be final
  • Some of the private properties in the above class needed to be switched to protected
  • I extended the above class to overwrite start(), so that the browser process start is skipped (it is permanently running in another container)

I will stick with what I have, but it is not great code. The authors of Panther really did not want it to be extended in this fashion! Perhaps I will submit an improvement request, so that this can be done in a more elegant way.

Now that I look at it afresh, it might have been easier just to copy FirefoxManager and amend the start() method in situ. Still not a nice solution though.

For now, if you want to run your browser as a separate container, using Selenium probably is the most straightforward way.

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

No branches or pull requests

2 participants