Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to intercept network traffic using Chrome DevTools protocol #441

Open
1 of 5 tasks
bhavesh-salia opened this issue Apr 19, 2023 · 3 comments
Open
1 of 5 tasks

Comments

@bhavesh-salia
Copy link

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
  • Maven
  • Gradle
  • Ant
  • Eclipse
@cjayswal
Copy link
Member

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>

@bhavesh-salia
Copy link
Author

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

@bhavesh-salia
Copy link
Author

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

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

No branches or pull requests

2 participants