qaf icon indicating copy to clipboard operation
qaf copied to clipboard

Unable to intercept network traffic using Chrome DevTools protocol

Open bhavesh-salia opened this issue 1 year ago • 3 comments

QAF Version 3.1.0

Selenium Version 4.2.2

Steps To Reproduce

    1. Add 'selenium-devtools-v102' version 4.2.2 dependency to POM file
    		<dependency>
    		<groupId>org.seleniumhq.selenium</groupId>
    		<artifactId>selenium-devtools-v102</artifactId>
    		<version>4.2.2</version>
    		<scope>test</scope>
		</dependency>
2. Set browserstackOptions.put("seleniumCdp", "true")
    3. Add below code to intercept network traffic: 
            QAFExtendedWebDriver d = new WebDriverTestBase().getDriver();
	    Augmenter augmenter = new Augmenter();
	    WebDriver driver = augmenter.augment(d);
	    DevTools devTools = ((HasDevTools) driver).getDevTools();
            devTools.createSession();
            devTools.send(Network.enable(Optional.empty(),Optional.empty(), Optional.empty()));

             devTools.addListener(Network.responseReceived(), response ->
		{		
			Response res=response.getResponse();
                         System.out.println(res.getUrl());
                        System.out.println(res.getStatus());
		});
              driver.get("https://www.google.com/);			
  4. Below values are set in property file for Browserstack run 
   driver.name=chromeRemoteDriver
   driver.capabilities.browserName=Chrome
   driver.capabilities.browserVersion=102
 5. Imports
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.HasDevTools;
import org.openqa.selenium.devtools.v102.network.Network;
import org.openqa.selenium.devtools.v102.network.model.Response;
import org.openqa.selenium.remote.Augmenter;

Expected behavior

Network traffic is intercepted successfully

Actual behavior

Below error is displayed

java.lang.RuntimeException: java.lang.IllegalAccessException: no private access for invokespecial: class com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver$ByteBuddy$RRwfyGbl, from com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.executeSuper(QAFExtendedWebDriver.java:246) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.executeWithoutLog(QAFExtendedWebDriver.java:255) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.executeWitoutLog(QAFExtendedWebDriver.java:300) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.execute(QAFExtendedWebDriver.java:278) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.execute(QAFExtendedWebDriver.java:232) ~[qaf-3.1.0.jar:?]
	at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:351) ~[selenium-remote-driver-4.2.2.jar:?]
	at com.slickdeals.automation.web.stepLibrary.AdStackStepLibrary.verifyCallIsMadeWhenUserOpens_aroundBody14(AdStackStepLibrary.java:145) ~[test-classes/:?]
	at com.slickdeals.automation.web.stepLibrary.AdStackStepLibrary$AjcClosure15.run(AdStackStepLibrary.java:1) ~[test-classes/:?]
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:167) ~[aspectjrt-1.9.5.jar:?]
	at com.qmetry.qaf.automation.step.JavaStepReporter.javaTestStep(JavaStepReporter.java:93) ~[qaf-3.1.0.jar:?]
	at com.slickdeals.automation.web.stepLibrary.AdStackStepLibrary.verifyCallIsMadeWhenUserOpens(AdStackStepLibrary.java:107) ~[test-classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291]
	at com.qmetry.qaf.automation.step.JavaStep.doExecute(JavaStep.java:150) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.step.BaseTestStep.execute(BaseTestStep.java:149) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.step.StringTestStep.execute(StringTestStep.java:128) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.step.client.Scenario.execute(Scenario.java:174) ~[qaf-3.1.0.jar:?]
	at com.qmetry.qaf.automation.step.client.Scenario.scenario(Scenario.java:237) ~[qaf-3.1.0.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291]
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104) ~[testng-6.10.jar:?]
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:645) ~[testng-6.10.jar:?]
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851) ~[testng-6.10.jar:?]
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177) ~[testng-6.10.jar:?]
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) ~[testng-6.10.jar:?]
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) ~[testng-6.10.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_291]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_291]
	at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_291]
Caused by: java.lang.IllegalAccessException: no private access for invokespecial: class com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver$ByteBuddy$RRwfyGbl, from com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver
	at java.lang.invoke.MemberName.makeAccessException(MemberName.java:850) ~[?:1.8.0_291]
	at java.lang.invoke.MethodHandles$Lookup.checkSpecialCaller(MethodHandles.java:1572) ~[?:1.8.0_291]
	at java.lang.invoke.MethodHandles$Lookup.findSpecial(MethodHandles.java:1002) ~[?:1.8.0_291]
	at com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver.executeSuper(QAFExtendedWebDriver.java:237) ~[qaf-3.1.0.jar:?]
	... 32 more

java.lang.IllegalAccessException: no private access for invokespecial: class com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver$ByteBuddy$RRwfyGbl, from com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver

Is the issue reproducible on runner?

  • [ ] QAS
  • [x] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse

bhavesh-salia avatar Apr 19 '23 03:04 bhavesh-salia

Will you please check which version of selenium-java dependency you are using? If you have not added any you can try adding 4.2.2 (possibility on top of other dependencies )

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.2.2</version>
</dependency>

cjayswal avatar Apr 19 '23 04:04 cjayswal

I'm using 4.2.2 version of selenium-java dependency and its added on the top of other dependencies as well...

bhavesh-salia avatar Apr 19 '23 07:04 bhavesh-salia

@cjayswal following up to see if there's any update on this issue...

bhavesh-salia avatar Apr 24 '23 16:04 bhavesh-salia