Home / Function/ click() — langchain Function Reference

click() — langchain Function Reference

Architecture documentation for the click() function in crawler.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a568a47c_223d_5e43_b052_ae9cd4915f78["click()"]
  73034b47_6ada_6cee_4b85_e74b6a3e14f1["Crawler"]
  a568a47c_223d_5e43_b052_ae9cd4915f78 -->|defined in| 73034b47_6ada_6cee_4b85_e74b6a3e14f1
  0d17c403_8681_a93a_1e43_a269b13f41dc["type()"]
  0d17c403_8681_a93a_1e43_a269b13f41dc -->|calls| a568a47c_223d_5e43_b052_ae9cd4915f78
  style a568a47c_223d_5e43_b052_ae9cd4915f78 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/natbot/crawler.py lines 112–134

    def click(self, id_: str | int) -> None:
        """Click on an element with the given id.

        Args:
            id_: The id of the element to click on.
        """
        # Inject javascript into the page which removes the target= attribute from links
        js = """
		links = document.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++) {
			links[i].removeAttribute("target");
		}
		"""
        self.page.evaluate(js)

        element = self.page_element_buffer.get(int(id_))
        if element:
            x: float = element["center_x"]
            y: float = element["center_y"]

            self.page.mouse.click(x, y)
        else:
            print("Could not find element")  # noqa: T201

Subdomains

Called By

Frequently Asked Questions

What does click() do?
click() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/natbot/crawler.py.
Where is click() defined?
click() is defined in libs/langchain/langchain_classic/chains/natbot/crawler.py at line 112.
What calls click()?
click() is called by 1 function(s): type.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free