#5 - How to extract Network Responses and status codes with Selenium Listeners Implementation
Вставка
- Опубліковано 15 жов 2024
- In this video, I have explained how to extract Network responses,headers and status codes with Selenium for better Integration testing.
Please check out Selenium 4 Latest Features Playlist to watch all the concepts in sequence
Get Lifetime access to all 30+ Automation courses with one single Subscription from below link.
rahulshettyaca...
*****************************************************************************
Thanks
Rahul Shetty - QA Trainer/entrepreneur
Website : rahulshettyaca...
LinkedIn : / rahul-she. .
FB QA Group : / rahul. .
Telegram Group for Interview Prep
t.me/rahulshet...
Very useful. Thanks for sharing. Will it work for Post call as well? need to get response after clicking final button in the UI
Great content....but where we need to add this in a bdd framework?
Hi sir,
How can i get preview of that request
Hi .can you please let me know What is the java version you have used for this .
Is there any video of python selenium for same issue.?
Great, can you access the actual response date like error message returned from the back-end
Hello, I want to get the size out, how do I do that?
Can you do the same using poweshell and selenium webdriver DLL?
Thank you so much!
Hi,
I am trying to add "DevTools devtools = driver.getDevTools(). But it is giving me an error. I tried to import different devtools library version but not working
same with me. Did you find out the solution?
@@HenryLeu Did you find solution?
@@filipkostic6580 I only found a 3rd Java library that someone else wrote.
your tititle says extract network response. But I don't see how you extract the reponse body? I want to extract the response body from the network tab under "response" section. How do I do that?
Hey did you get that? Even I needed that part.. In Python!
@@mrp5249 no I didn't. I searched every where on Google. Some people suggest using chrome dev tools. But that one doesn't let you get the XHR response body.
Hey Henry bro, did you find a solution? I am also looking for python equivalent.
@@vikraal6974 still searching
Can we chk in edge browser
Hi Sir, How to capture the traffic on a button click? In your video, does it captured the traffic when virtual Library button is clicked
execute this code after the button click, it will listen to all responses received by browser.
is there a way to assert on these responses? I can assert them inside the "addListener" method, but the test does't really quit/stop on failure.
do soft assertions
Were you able to do the assertion I have to do this in another method so need to save response body and call somewhere else.
my webdriver does not have GetDevTools() method???
Getting below error while passing Optional.empty() in Network.send
"The method enable(Optional, Optional, Optional) in the type Network is not applicable for the arguments (Optional, Optional, Optional)"
Selenium code as below:
import java.util.Optional;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v95.network.Network;
import io.github.bonigarcia.wdm.WebDriverManager;
public class gdeLoginFlow {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("test/login");
driver.findElement(By.xpath("//*[@id='loginId']")).sendKeys("username);
driver.findElement(By.xpath("//*[@id='password']")).sendKeys("pwd@");
driver.findElement(By.xpath("//button[@class='blue button']")).click();
DevTools devTools = ((ChromeDriver) driver).getDevTools();
devTools.createSession();
devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));
}
}
same for me. and I think author will not provide the support unless we purchase the full course
org.openqa.selenium.devtools.DevToolsException: You are using a no-op implementation of the CDP. The most likely reason for this is that Selenium was unable to find an implementation of the CDP protocol that matches your browser. Please be sure to include an implementation on the classpath, possibly by adding a new (maven) dependency of `org.seleniumhq.selenium:selenium-devtools-vNN:4.0.0-beta-2` where `NN` matches the major version of the browser you're using. "I am facing this error"
you have to change the selenium version