Class SeleniumDocumentLoader

java.lang.Object
dev.langchain4j.data.document.loader.selenium.SeleniumDocumentLoader
All Implemented Interfaces:
AutoCloseable

public class SeleniumDocumentLoader extends Object implements AutoCloseable
Utility class for loading web documents using Selenium. Returns a Document object containing the content of the Web page.
  • Method Details

    • pageReadyCondition

      public SeleniumDocumentLoader pageReadyCondition(org.openqa.selenium.support.ui.ExpectedCondition<Boolean> condition)
      Set a custom page ready condition for waiting until the page is loaded.
      Parameters:
      condition - the ExpectedCondition to use
      Returns:
      this loader instance
    • load

      public Document load(String url, DocumentParser documentParser)
      Loads a document from the specified URL.
      Parameters:
      url - The URL of the file. Must not be null.
      documentParser - The parser to be used for parsing text from the URL. Must not be null.
      Returns:
      document
    • close

      public void close()
      Closes the underlying WebDriver instance.
      Specified by:
      close in interface AutoCloseable
    • builder

      public static SeleniumDocumentLoader.Builder builder()