Search code examples
selenium-webdriverselenium-chromedriverwdio

How to properly replace @wdio/selenium-standalone-service service?


Setup / What I have done so far

I am currently updating our project and we still use some older (@[email protected] and up version). They have deprecated the "@wdio/selenium-standalone-service service". I read about it here:

There used to be an option to configure this service:

config.services = ['selenium-standalone'];

Config is basically Options.Testrunner from "@wdio/types".

When I remove the dependency as well as the line above from my config, my tests run in the most recent chrome browser.

Issue I am facing

I have to make sure, that the local tests still run in selenium and are not executed with e.g. chromedriver. I want to make sure that there is no difference when I execute tests locally and on gitlab CI.

When I used to run the tests, it said:

INFO webdriver: Initiate new session using the WebDriver protocol

Now it says:

INFO devtools:puppeteer: Initiate new session using the DevTools protocol
[0-0] 2024-02-06T16:55:36.106Z INFO devtools: Launch Google Chrome (undefined) with flags: --enable-automation --disable-popup-blocking --disable-extensions --disable-background-networking --disable-background-timer-throttling...

Question

How can I configure it so it still uses selenium? I want to upgrade only what is the bare minimum. Maybe I am missing something.


Solution

  • I fixed the issue by just specifying config.services = []. Since I removed this entry completely, it was undefined and it seems that wdio tried to run it with the fallback i.e. DevTools Protocol. It now uses the WebDriver Protocol as expected.

    Also, I've learned that selenium was only used to download the drivers and it is fully integrated now, so I don't need any additional selenium server to run it locally.