Skip to content

Fix documentation typo #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# reCAPTCHA Solver Using 2Captcha and Selenium

This project automates [bypass Google reCAPTCHA] v2 with image challenges (3x3 and 4x4) using the 2Captcha service
([captcha solver]) and Selenium WebDriver. The script programmatically interacts with reCAPTCHA, retrieves data for
[captcha solver] and Selenium WebDriver. The script programmatically interacts with reCAPTCHA, retrieves data for
solving, sends it to [reCAPTCHA solver] for processing, and then submits the solution.

![bypass_recaptcha_v2_selenium_final2.gif](media%2Fbypass_recaptcha_v2_selenium_final2.gif)
Expand Down Expand Up @@ -32,7 +32,7 @@ The project is structured as follows:
### Clone:

```
git clone git@github.com:2captcha/selenium-recaptcha-solver-using-grid.git
git clone https://github.com/2captcha/selenium-recaptcha-solver-using-grid.git
cd selenium-recaptcha-solver-using-grid
```

Expand All @@ -50,11 +50,13 @@ pip install -r requirements.txt

### Configure:

Set the `APIKEY` environment variable. You can get the `APIKEY` value in your personal [2captcha account][2captcha].

For Linux/Mac:
`export APIKEY=your_api_key`

You can also set the value of `APIKEY` directly in the code. To do this, modify the `apikey` value in the following file: [main.py, line 10].
For Windows:
`set APIKEY=your_api_key`

You can also set the value of `APIKEY` directly in the code. To do this, modify the `apikey` value in the following file: [main.py line 10].

### Example Command
```bash
Expand Down
5 changes: 3 additions & 2 deletions js_scripts/get_captcha_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ window.getCaptchaData = () => {
return new Promise((resolve, reject) => {
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let comment = document.querySelector('.rc-imageselect-desc-wrapper').innerText.replace(/\n/g, ' ');
let comment = document.querySelector('.rc-imageselect-desc-wrapper')?.innerText?.replace(/\n/g, ' ') || '';

let img4x4 = document.querySelector('img.rc-image-tile-44');
if (!img4x4) {
let table3x3 = document.querySelector('table.rc-imageselect-table-33 > tbody');
if (!table3x3) {
reject('Can not find reCAPTCHA elements');
return;
}

let initial3x3img = table3x3.querySelector('img.rc-image-tile-33');
Expand All @@ -26,7 +27,7 @@ window.getCaptchaData = () => {
{ x: 0, y: ctx.canvas.height / 3 * 2 }, { x: ctx.canvas.width / 3, y: ctx.canvas.height / 3 * 2 }, { x: ctx.canvas.width / 3 * 2, y: ctx.canvas.height / 3 * 2 }
];
updatedTiles.forEach((t) => {
const ind = t.parentElement.parentElement.parentElement.tabIndex - 3;
const ind = t.parentElement?.parentElement?.parentElement?.tabIndex - 3 || 0;
ctx.drawImage(t, pos[ind - 1].x, pos[ind - 1].y);
});
}
Expand Down