I had coded a test case for Automation in Selenium to get all the requests on the web page including Clicked Elements. But I think I'm not able to get all the requests on my web page.
@BeforeTest
public void ConfigureProxy(){
proxy = new BrowserMobProxyServer();
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
System.setProperty("webdriver.chrome.driver", driverPath+"chromedriver");
driver = new ChromeDriver(capabilities);
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.REQUEST_BINARY_CONTENT);
proxy.newHar("MakeMyTripSearchFlights1");
driver.get("https://www.makemytrip.com/");
}
@Test
public void TestFlightSubmit(){
driver.findElement(By.className("widgetSearchBtn"));
}
@AfterTest
public void getData(){
Har har = proxy.getHar();
File harFile = new File(FileName);
try {
har.writeTo(harFile);
} catch (IOException e) {
System.out.println(e.toString());
System.out.println("Could not find file " + FileName);
}
/*if (driver !=null){
proxy.stop();
driver.quit();
}*/
}
And I'm also getting an ERROR :
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/int777/.m2/repository/io/netty/netty-all/4.0.51.Final/netty-all-4.0.51.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2534 [main] INFO org.littleshoot.proxy.impl.DefaultHttpProxyServer - Starting proxy at address: 0.0.0.0/0.0.0.0:0
2581 [main] INFO org.littleshoot.proxy.impl.DefaultHttpProxyServer - Proxy listening with TCP transport
2670 [main] INFO org.littleshoot.proxy.impl.DefaultHttpProxyServer - Proxy started at address: /0:0:0:0:0:0:0:0:39399
Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 20794
Only local connections are allowed.
Jun 21, 2019 12:17:42 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS