Skip to main content

How to use Solve Recaptcha v2 nodes?

· 7 min read
Cansel Kahraman
RPA Developer

Many times, we encounter different types of CAPTCHAs on various websites. You can solve them using the 'capMonster' package. For instance, when you come across the "I'm not a Robot" checkbox CAPTCHA, you can use the "Solve Recaptcha v2" node from the 'capMonster' package. In this blog post, we will explore the ins and outs of using the "Solve Recaptcha v2" node to perform conditional operations in your flow.

How to Setup?

To begin, Login to your Robomotion workspace. If you haven't registered yet, you can create your workspace from the provided link. Once you've gained access to your workspace, ensure that the 'capMonster' package is installed within your workspace.

About the Cap Monster Package

The CapMonster package plays an essential role in assisting developers with automating processes on various websites, helping them overcome CAPTCHA challenges. It enhances the efficiency and effectiveness of their automation projects, especially in scenarios where automation encounters various website flows with different types of CAPTCHAs, including text-based CAPTCHAs, image-based CAPTCHAs, and reCAPTCHAs. The versatility offered by the CapMonster package in solving these diverse CAPTCHA types makes it a suitable choice.

What is the 'Node Name' Node?

To effectively handle various CAPTCHA types while working with CapMonster package nodes, it is essential to download the 'CapMonster' package from the packages menu within your automation or development environment.

This package provides you with the necessary tools and capabilities to address different CAPTCHA challenges during the automation process.

To obtain the 'CapMonster' package, please follow the steps outlined below:

Packages Icon

Install icons for Cap Monster Packages

Node Overview

  • Inject: This node initializes the flow.

  • Function: In this node, you define variables, objects, and other elements to be used in the flow.

  • Open Browser: This node assists in opening various web browsers.

  • Open Link: This node assists in opening a specified 'URL'.

  • Run Script: If you want to modify a value on a specific website or scrape data from websites, you can use this node.

  • Click Element: This node is designed for clicking on elements within a website.

  • Close Browser: This node is designed to close an opened browser.

  • Create Session: To use the 'Solve Recaptcha v2' nodes, you should first create a session by utilizing the 'Cap Monster' keys.

  • Solve Recaptcha v2: This node is specifically designed for solving various types of v2 CAPTCHAs.

  • Get Result: You can confirm the solved CAPTCHA by checking the response using the 'Get Result' node.

  • Switch: When checking variable values to determine the appropriate course of action, you can use the 'Switch' node.

  • Sleep: This node is used to wait without performing any action until a specified time is reached.

  • Goto: To ensure flow continuity, this node provides the connection and routing between the nodes used for process repetition when an error is received. When the flow reaches this node, it continues from wherever it was redirected.

  • Label: This node manages the redirection of the 'Goto' node and continues the flow from its location.

  • Stop: This node is used to halt the flow.

Flow Steps

  1. Access to the workspace is granted by following the instructions outlined in the "How to Set Up" section.

  2. The 'Inject' node is used to initialize the flow.

  3. To begin, create a variable named 'website_url' to store your specified website URL. You will utilize this variable when opening the website using the 'Open Link' node.

msg.website_url = "https://www.google.com/recaptcha/api2/demo"; //The website_url variable use to aceess website.
return msg;
  1. You should utilize the 'Open Browser' node to open your preferred web browser. Select the desired browser type from the 'Browser' options.

Open Browser Node Details

  1. To open a specified URL that you've created under the 'Function' node, you should use the 'Open Link' node and populate the input options of 'URL' type with the 'msg' object.

Open Link Node Details

  1. To create a session using the 'Cap Monster' package and the 'Create Session' node, you need to acquire a Cap Monster API Key. You can generate this API Key by visiting the website https://capmonster.cloud/en/ .

Create Session Node Details

  1. You can access the 'API KEY' from the flows by initially creating a 'Vault' and then adding an 'API KEY' item.
  • Click on 'Vaults'.

Click Vaults

  • Set your workspace password and then click on 'Open'.

Set your workspace password to access the vaults

  • Create a 'Vault' and save the 'Vault Secret Key'.

Create53Vault

Set vault details

Vault Secret Key

  • Create Item and set your ‘API KEY’ this item.

Vault Secret Key

  1. To fill in the 'Website URL' and 'Website Key' fields in the 'Solve Recaptcha v2' Node, follow these steps:

Go to the website where you want to solve the reCAPTCHA.

Open your web browser's developer tools by pressing 'F12' or by right-clicking on the webpage and selecting "Inspect" or "Inspect Element."

In the developer tools panel that opens, switch to the "Elements" tab.

Use the search function by pressing 'Ctrl + F' (or 'Cmd + F' on Mac) to open the search bar.

In the search bar, type 'sitekey' and press 'Enter' to search for this keyword within the webpage's HTML code.

Locate the 'sitekey' value in the HTML code; it typically appears as an attribute within a reCAPTCHA-related element, like this: data-sitekey="your-sitekey-value-here."

Copy the 'sitekey' contents, which represent your 'Website Key,' and paste it into the appropriate field in the 'Solve Recaptcha v2' Node.

By following these steps, you can extract the 'Website Key' from the website's HTML source code and use it in the 'Solve Recaptcha v2' Node.

Solve Recaptcha v2 Node Details

Find Sitekey

You should verify whether the captcha-solving process has completed successfully or is still in progress by using the 'Get Result' node from the 'Cap Monster' package.

Example of a response from the 'Get Result' node:

Get Result Outputs Alternative 1

  1. If the value of the status is 'processing' or if there is a different error, proceed with the 'Sleep' node, wait until the specified time has elapsed, and then proceed to the 'Get Result' node to check the response.

  2. Check the response of the 'Get Result' node by using the 'Switch Node.' If the status value in the response is 'Processing,' you should recheck. If the response contains a solution, it indicates that the captcha has been successfully solved.

Get Result Outputs Alternative 2

  1. If the response has the value 'solution,' you should set the 'gRecaptchaResponse' value to 'textarea.value' using the 'Run Script' node.

Get Result Outputs Alternative 2 Details

var textarea = document.querySelector("#g-recaptcha-response");
textarea.value = msg.response.solution.gRecaptchaResponse;

  1. Next, click the 'Submit' button and then use the 'Close Browser' node to close the browser.

  2. Stop the flow with the 'Stop' node.

Solve Recaptcha v2 Flows

Here you can access the complete flow by clicking on the following link: https://casestudies.robomotion.io/designer/shared/AfYBKkddza1fusvh25C5Lx