Skip to content

[🐛 Bug]: Issue when using EventFiringDecorator<T> on RemoteWebdriver. #11432

Closed
@adngzz

Description

@adngzz

What happened?

When I am using a decoratedWebdriver with a specified driver type, the listeners are not being called.
For example this:
RemoteWebDriver rem= new EventFiringDecorator<RemoteWebDriver>(RemoteWebDriver.class, eventListener).decorate(new RemoteWebDriver(new URL(TestData.REMOTE_HUB_LOCATION.getValue()), capabilities)

On the other hand using normal webdriver works as expected.

WebDriver web= new EventFiringDecorator(eventListener).decorate(new RemoteWebDriver(new URL(TestData.REMOTE_HUB_LOCATION.getValue()), capabilities)

As can be seen in the output log, running the first one doesn't trigger the logging in the listener while the second part does.

How can we reproduce the issue?

//log and variables initialization
		initVariables(data);		
		initTestLog();
		
		
		
		WebDriverListener eventListener = new customWebDriverListener();



		//decorated remote webdriver
		RemoteWebDriver rem=new EventFiringDecorator<RemoteWebDriver>(RemoteWebDriver.class, eventListener).decorate(new RemoteWebDriver(new URL(TestData.REMOTE_HUB_LOCATION.getValue()), getCapabilities()));
		rem.navigate().to("https://www.wikipedia.org");
		rem.findElement(By.cssSelector("#search-form button")).click();
		rem.quit();
		
		System.out.println("*****************************************************************");
		
		//decorated remotewebdriver as a webdriver
		WebDriver web=new EventFiringDecorator(eventListener).decorate(new RemoteWebDriver(new URL(TestData.REMOTE_HUB_LOCATION.getValue()), getCapabilities()));
		web.navigate().to("https://www.wikipedia.org");
		web.findElement(By.cssSelector("#search-form button")).click();
		web.quit();

Relevant log output

[RemoteTestNG] detected TestNG version 7.7.0
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 1 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 3 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 9 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
[main] INFO org.testng.internal.Utils - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
[main] INFO org.testng.internal.Utils - [TestNG] Running:
  C:\Users\rgonzalezv\AppData\Local\Temp\testng-eclipse-1425567915\testng-customsuite.xml

[main] INFO org.testng.internal.Utils - [Utils] DynamicGraphHelper.createDynamicGraph() took 4 ms.
[31][Firefox] Assigning browser specific capabilities..
[31][Firefox] Browser console logging enabled.
[31][Firefox] Loading custom firefox profile...
dic 15, 2022 11:18:17 A.�M. org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer createTracer
INFO: Using OpenTelemetry for tracing
*****************************************************************
[31][Firefox] Assigning browser specific capabilities..
[31][Firefox] Browser console logging enabled.
[31][Firefox] Loading custom firefox profile...
[31][Firefox] Attempting to Navigate to: https://www.wikipedia.org
[31][Firefox] Navigated: https://www.wikipedia.org Duration: PT5.2031244S
[31][Firefox] Click successful on element: [[RemoteWebDriver: firefox on WINDOWS (4fd7b88a-f219-4272-9404-1964474eaea3)] -> css selector: #search-form button] Duration: PT2.2510417S
PASSED: com.peektraffic.spinnaker.Visual.Test_Visual.test

===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Passes: 1, Failures: 0, Skips: 0
===============================================

[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.internal.ExitCodeListener@535779e4: 0 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@561868a0: 60 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.jq.Main@2a448449: 161 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.FailedReporter@32f232a5: 1 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.XMLReporter@49cb9cb5: 16 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.EmailableReporter2@74eb909f: 13 ms
[main] INFO org.testng.internal.Utils - [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@2826f61: 8 ms

Operating System

Windows 10

Selenium version

selenium 4.7.2 on Java 19

What are the browser(s) and version(s) where you see this issue?

firefox 107.0.1

What are the browser driver(s) and version(s) where you see this issue?

Firefox geckodriver

Are you using Selenium Grid?

4.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions