How can I use 2Captcha com o Robot Framework?

I’m not getting the TwoCaptcha library

How can I use 2Captcha com o Robot Framework? I need to validate user access, the site is of the government type and has no API or release. It is a project for consultations of CNDs of the local municipality.


my codat.yaml

For more details on the format and content:

rcc/recipes.md at master · robocorp/rcc · GitHub

Tip: Adding a link to the release notes of the packages helps maintenance and security.

channels:

  • conda-forge

dependencies:

Define conda-forge packages here → Search :: Anaconda.org

When available, prefer the conda-forge packages over pip as installations are more efficient.


my robot.yaml

For more details on the format and content:

rcc/recipes.md at master · robocorp/rcc · GitHub

tasks:

Task names here are used when executing the bots, so renaming these is recommended.

Run all tasks:
shell: python -m robot --report NONE --outputdir output --logtitle “Task log” tasks.robot

condaConfigFile: conda.yaml

environmentConfigs:

  • environment_windows_amd64_freeze.yaml
  • environment_linux_amd64_freeze.yaml
  • environment_darwin_amd64_freeze.yaml
  • conda.yaml

artifactsDir: output

PATH:

  • .C:/users/ansel/miniconda3/lib/site-packages/

PYTHONPATH:

  • .C:/users/ansel/miniconda3/lib/site-packages/2captcha_python-1.2.0.dist-info

ignoreFiles:

  • .gitignore

At least those PATH and PYTHONPATH entries are incorrect. You should not put entries in your local machine on robot.yaml. Our tooling will create environment for you, and if your conda.yaml has valid dependencies, then they should just work.

Can you tell, what failure you have, when you using this library?

And since that is just python library, have you already created your own custom keywords to provide that functionality to your RF level use?

1 Like

This is the error message when using #Library TwoCaptcha

Unresolved library: TwoCaptcha.
Error generating libspec:
Execution stopped by user.


the installation was done via pip
in pip list shows me version #2captcha-python 1.2.0


coda.yaml

channels:

  • conda-forge

dependencies:

  • python=3.9.13
  • pip=22.1.2
  • pip:
    - rpaframework==22.0.0
    - robotframework-ocrlibrary==2.0.0
    - 2captcha-python==1.2.0

robot.yaml
tasks:
Run all tasks:
shell:python -m robot --report NONE --outputdir output --logtitle “Task log” tasks.robot

condaConfigFile: conda.yaml

environmentConfigs:

  • environment_windows_amd64_freeze.yaml
  • environment_linux_amd64_freeze.yaml
  • environment_darwin_amd64_freeze.yaml
  • conda.yaml

artifactsDir: output

PATH:

  • .

PYTHONPATH:

  • .

ignoreFiles:

  • .gitignore

Have you written your own “TwoCaptcha.py” robotframework library? I only see you adding python library “2captcha-python” into environment, but that wont work directly from robot. You have to write one yourself, or find some ready made wrapper for it. Currently RPA framework does not provide that either (to best of my knowledge).

So you cannot directly refer plain python module as “Library TwoCaptcha”, something should provide that library. See this: How to write and use custom Robot Framework Python RPA libraries | Robocorp documentation

And you can always write your own. And maybe make it open source too.

2 Likes