Selenium Intern issue: ERROR - suiteEnd message received for session that does not exist

I have been attempting to set up functional testing using Intern 4 with a headless Chrome browser. I have installed selenium-server-standalone on my Mac terminal and believe everything is configured correctly. However, when I try to run the test, I encounter the following error:

Running "exec:test_functional" (exec) task
Listening on localhost:9000 (ws 9001)
Tunnel started
BUG: suiteEnd was received for invalid session 
(ノಠ益ಠ)ノ彡┻━┻
UnknownError: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":{"name":"intern","idle-timeout":60,"browserName":"chrome","goog:chromeOptions":{"args":["headless","disable-gpu"]}}}] Cannot define class using reflection
  at Server.post  <tests/node_modules/src/Server.ts:367:14>
  at Server.createSession  <tests/node_modules/src/Server.ts:412:14>
  at Suite.before  <tests/src/lib/executors/Node.ts:469:8>
  at <tests/src/lib/Suite.ts:388:19>
  at new Task  <tests/node_modules/@dojo/core/async/Task.ts:239:3>
  at runLifecycleMethod  <tests/src/lib/Suite.ts:355:10>
  at before  <tests/src/lib/Suite.ts:458:10>
  at Suite.run  <tests/src/lib/Suite.ts:477:6>
  at <tests/src/lib/executors/Node.ts:821:20>
  at FunctionQueue.next  <tests/src/lib/executors/Node.ts:945:16>

TOTAL: tested 0 platforms, 0 passed, 0 failed; fatal error occurred
>> Exited with code: 1.
>> Error executing child process: Error: Process exited with code 1.
Warning: Task "exec:test_functional" failed. Use --force to continue.

Aborted due to warnings.

I am using the latest versions of Node, npm, and Intern.

Any assistance in resolving this issue would be greatly appreciated.

EDIT:

app.ts

// tests/functional/app.ts
const { suite, before, test } = intern.getPlugin("interface.tdd");
const { expect, assert } = intern.getPlugin("chai");

suite("app", () => {
  before(({ remote }) => {
    return remote
      .get("src/app.html")
      .setFindTimeout(5000)
      .findDisplayedByCssSelector("body");
  });

  let windowHandles: any;

  test("testing", ({ remote }) => {
    return remote
      // Click login button
      .findByClassName('hero-cta')
      .click()
      .end()

      // Switch to login window
      .getAllWindowHandles()
      .then(function(handles: string[]){
        windowHandles = handles;
        assert.isArray(windowHandles);
        return remote.switchToWindow(windowHandles[1]);
      })

      // Input user credentials and submit
      .findById('user_username')
      .type('username')
      .end()
      .findById('user_password')
      .type('password')
      .findAllByCssSelector('button')
      .click()
      .end()

      //Switch to app
      .getAllWindowHandles()
      .then(function(handles: string[]){
        assert.isArray(handles);
        return remote.switchToWindow(windowHandles[0]);
      })

      .find('css selector','span')
      .getVisibleText()
      .then(function(text: string) {
        console.log(text);
      })
  });
});

intern.json

{
...

"environments": [
    {
      "browserName": "chrome",
      "goog:chromeOptions": {
        "args": ["headless", "disable-gpu"]
      }
    }
  ]
}

Answer №1

The error message "Cannot define class using reflection" typically occurs when the version of Java installed on your computer is too advanced for Selenium to handle (Selenium being the tool that manages WebDriver connections for Intern). In order for Selenium to work properly, it requires Java 1.8; if your system defaults to Java 10 or 11, this issue may arise.

It is important to mention that there is no need to manually install selenium-server-standalone for Intern tests. Intern will automatically download Selenium and the necessary WebDriver tunnels, as well as handle the starting and stopping of its own instance of Selenium.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Typescript to resolve a package from a location other than the default node_modules directory

I am currently delving into typescript and eager to start dabbling in creating packages. Here is the current layout of my project: myProject/ ├── node_modules/ ├── src/ │ ├── app │ ├── index.ts │ ├── packages ...

How to prevent duplicate database entries in Angular forms?

Currently, I am working on a project using Angular and TypeScript. The goal is to retrieve a list of users from an API and allow for the addition of new users. However, I am struggling with determining how to verify if a user with a specific name already e ...

What is the best approach for implementing Vuex with TypeScript?

My research on the topic has primarily led me to this informative article. I am currently working on setting up a store with 2 modules. export interface RootState { /** root state props **/ } const store: StoreOptions<RootState> = { module ...

Utilizing Regular Expressions in Angular 4 by Referencing Patterns Stored in an Object

I'm facing an issue where my code is functional, but I keep encountering a Tslint error that's proving difficult to resolve. This particular configuration worked fine with Angular 1, but now I'm in the process of migrating the application to ...

Creating TypeScript versions of `delegate` pattern JavaScript code

Looking for a way to convert the following javascript code into typescript? const handlers = { say (msg) { console.log(msg) }, add (a, b) { return a + b } } function caller (method, ...args) { if (handlers[method]) return handlers[methd ...

Having trouble launching a Firefox browser instance for testing with Visual Studio, C#, Nunit, and Selenium

I am encountering some issues while attempting to execute a basic UI test in Visual Studio (version 16.11.10) using C# and NUnit. The versions of Selenium.Firefox.WebDriver, Selenium.WebDriver, and Selenium.Support that I am using are 0.27.0, 4.1.0, and 4. ...

Embedded template does not utilize property binding ngif with any directive

I am currently working on an Angular (Angular2 RC4) application and I'm facing some challenges running it with the live server in nodejs. Any suggestions on how to troubleshoot the error showing up in the Chrome console would be greatly appreciated. ...

Transform the output of beautifulsoup into a dictionary structure

I've been struggling to convert the output I received from beautifulsoup into a dictionary to eventually convert it into a pandas dataframe. Despite trying multiple approaches that didn't yield results, I'm currently at an impasse. Is there ...

In order to address the webdriver.gecko.driver problem in Selenium WebDriver, one must establish the correct path to the driver executable

I am currently attempting to execute the code snippet below: import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Test { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); ...

The functionality of the Protractor right click feature is smooth, however, there seems to be an issue with selecting

https://i.sstatic.net/KoGto.png Even though I can locate the button within the context menu, I am facing difficulty in clicking it. The code mentioned below is successfully able to click the button, but an error message pops up indicating: Failed: script ...

Change the Angular Material 2 theme from light to dark with a simple click

I'm working on an Angular 2 Material project and I want to be able to switch the theme from dark to light with a single click of a button. Can anyone help me figure out how to achieve this? Any tips or advice would be greatly appreciated! ...

Using Selenium with Python to automatically access all links in a dropdown menu

As a newcomer to Python, I've spent the last hour researching how to achieve this specific goal. The code I currently have almost accomplishes what I need - I want to open every category in a collapsible dropdown menu, then Ctrl+t each link within the ...

Creating personalized breakpoints in Material UI using TypeScript

When using the createMuiTheme() function, you have the ability to update breakpoint values like this. const theme = createMuiTheme({ breakpoints: { values: { xs: 0, sm: 600, md: 960, lg: 1280, xl: 1920, }, }, }) ...

Navigating through nested objects in a combined type

Is there a way to create a function that can take an object (which is part of a union) with a specified path and return the value of the config object for that specific path? I've been attempting the following: type Cat = { config: { meow: stri ...

What causes TS2322 to only appear in specific situations for me?

I have been trying to create HTML documentation for my TypeScript project using Typedoc. Within one of the many files, there is a snippet of code: public doSomething(val: number | undefined | null | string): string | undefined | null { if (val === null ...

Updating the dropdown option value in Angular 10's edit component

In my Angular and ASP.NET application, I have an edit form in a component with multiple select options in a dropdown list. When displaying all data in the edit form, the dropdown list fields are displayed as empty instead of showing the previously stored v ...

Angular's observable data fail to show on the screen

I am facing an issue with passing the data of an Observable fetched via an API request to a component variable for display. I have been trying but unable to make it work successfully. Any assistance would be greatly appreciated. Here is my code. Thank you. ...

Tips on utilizing Selenium to initiate a click action

Hey there, I've got two quick questions about Selenium! I'm pretty new to this framework. Here are the scenarios: <a href="http://url.com" onclick="somejsfunc();" title="title_text">HERE ARE SOME CHINESE CHARACTERS</a> and <a h ...

Starting the selenium server standalone on a Windows 10 system for the first time

Recently, I've been striving to integrate Selenium Server with my Yii2 project. After a successful installation of selenium-server-standalone on Windows 10 using the command: composer global require se/selenium-server-standalone However, upon attemp ...

Issue with tsconfig path alias not resolving when paths are outside of the baseUri

I've encountered an issue in my monorepo where the tsconfig doesn't resolve paths that are located above the current project directory. Here's an overview of my project structure: ── apps │ ├── sahl │ │ ├── index ...