Skip to content

String replace gets null as parameter #1052

Description

@art0s-dev

Bug description

Hello There,

This is the error message:
Whoops\Exception\ErrorException : str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated
[...]/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:271

$url = str_replace(':sessionId', $command->getSessionID(), $url);

The get session ID method is returning null.
Muting the Error works so far, but it's only a temporary solution.
Haven't looked deeper in the Package.

Cheers.

How could the issue be reproduced

SETUP:
- Java standalone server on docker-compose
- PestPHP as testing framework

<?php declare(strict_types=1);

use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;

beforeEach(function () {

    /error_reporting(E_ERROR);
    ini_set('display_errors', '1');

    $this->webdriver = RemoteWebDriver::create( 'http://localhost:4444/', DesiredCapabilities::chrome());
});

test("User can see the hello world message", function () {
    $this->webdriver->get('http://localhost:80');
    $text = $this->webdriver->findElement(WebDriverBy::tagName('body'))->getText();
    $this->assertEquals('hello there!',$text);
});

Expected behavior

Webdriver finds the text

Php-webdriver version

1.1.3

PHP version

8.1

How do you start the browser driver or Selenium server

Selenium server jar on Docker compose

Selenium server / Selenium Docker image version

4.8.0

Browser driver (chromedriver/geckodriver...) version

No response

Browser name and version

No response

Operating system

Ubuntu 22.10

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting for reactionFurther information/reaction is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions