java.lang.Object
co.verisoft.fw.selenium.junit.extensions.devtoolsExtension.Devtools

public class Devtools extends Object
  • Constructor Details

    • Devtools

      public Devtools()
  • Method Details

    • getResponseBody

      public static String getResponseBody(VerisoftDriver driver, String serviceName)
      Retrieves the body of the response for a specific service name from the network.
      Parameters:
      driver - The VerisoftDriver instance to interact with the network.
      serviceName - The name of the service whose response body is to be retrieved.
      Returns:
      The body of the response as a String.
    • getLastResponseByName

      public static org.openqa.selenium.devtools.v85.network.model.ResponseReceived getLastResponseByName(VerisoftDriver driver, String name)
      Attempts to retrieve the last response for a given service name within 10 seconds. The function checks if the list of responses is not changing in size. If the size remains constant, it fetches the response for the given name.
      Parameters:
      driver - The VerisoftDriver instance used for fetching network responses.
      name - The name of the service or URL part to search for in the response.
      Returns:
      The ResponseReceived instance corresponding to the service name, or null if not found within the timeout.
    • getLastResponse

      public static org.openqa.selenium.devtools.v85.network.model.ResponseReceived getLastResponse(VerisoftDriver driver)
      Retrieves the most recent network response recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      Returns:
      the latest Response object
    • getLastRequest

      public static org.openqa.selenium.devtools.v85.network.model.Request getLastRequest(VerisoftDriver driver)
      Retrieves the most recent network request recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      Returns:
      the latest Request object
    • getAllResponses

      public static List<org.openqa.selenium.devtools.v85.network.model.ResponseReceived> getAllResponses(VerisoftDriver driver)
      Retrieves all network responses recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      Returns:
      a list of all Response objects
    • getAllRequests

      public static List<org.openqa.selenium.devtools.v85.network.model.Request> getAllRequests(VerisoftDriver driver)
      Retrieves all network requests recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      Returns:
      a list of all Request objects
    • getNumOfLastResponses

      public static List<org.openqa.selenium.devtools.v85.network.model.ResponseReceived> getNumOfLastResponses(VerisoftDriver driver, int numOfRecentCalls)
      Retrieves the last 'num' network responses recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      numOfRecentCalls - the number of responses to retrieve
      Returns:
      a list of the last 'num' Response objects
    • getNumOfLastRequests

      public static List<org.openqa.selenium.devtools.v85.network.model.Request> getNumOfLastRequests(VerisoftDriver driver, int numOfRecentCalls)
      Retrieves the last 'num' network requests recorded for the given driver.
      Parameters:
      driver - the VerisoftDriver instance
      numOfRecentCalls - the number of requests to retrieve
      Returns:
      a list of the last 'num' Request objects
    • getAllConsoleLogs

      public static List<String> getAllConsoleLogs(VerisoftDriver driver)
      Returns all console logs stored in the given driver's store.
      Parameters:
      driver - The VerisoftDriver instance to retrieve console logs from.
      Returns:
      A List of all console logs as strings.
    • getLastConsoleLogs

      public static String getLastConsoleLogs(VerisoftDriver driver)
      Returns the last console log stored in the given driver's store.
      Parameters:
      driver - The VerisoftDriver instance to retrieve the last console log from.
      Returns:
      The last console log as a string.
    • getNumOfLastConsoleLogs

      public static List<String> getNumOfLastConsoleLogs(VerisoftDriver driver, int numOfLastConsoleLogs)
      Returns the last N console logs stored in the given driver's store.
      Parameters:
      driver - The VerisoftDriver instance to retrieve the console logs from.
      numOfLastConsoleLogs - The number of most recent console logs to retrieve.
      Returns:
      A List of the last N console logs as strings.
    • storeNamePerThreadAndSupportMultipleDriverForNetwork

      public static String storeNamePerThreadAndSupportMultipleDriverForNetwork(org.openqa.selenium.WebDriver driver)
      Generates a unique store name for the current thread, ensuring support for multiple drivers. Extracts the driver name from its string representation and appends it to the thread ID.
      Parameters:
      driver - the WebDriver instance
      Returns:
      a unique store name for network data