Git Product home page Git Product logo

Comments (7)

ad-m avatar ad-m commented on June 18, 2024

I can not reproduce captcha challenge. Could you verify result when you adapt callback sniffer (see https://github.com/ad-m/python-anticaptcha/blob/master/examples/recaptcha_selenium_callback.py )?

from python-anticaptcha.

davidwozabal avatar davidwozabal commented on June 18, 2024

I can not reproduce captcha challenge.

The problem is that the captcha only appears after several requests of the above type. Hence, it is hard to reproduce.

Could you verify result when you adapt callback sniffer (see https://github.com/ad-m/python-anticaptcha/blob/master/examples/recaptcha_selenium_callback.py )?

I am not sure how to adapt the example. If I interpret the code correctly, you are passing the token twice. The first time by setting the content of g-recaptcha-response in

driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML='{}';".format(token))

and the second time by calling

driver.execute_script("grecaptcha.recaptchaCallback[0]('{}')".format(token))

The problem is that the page that I am getting has no element g-recaptcha-response and when I execute the second line I get the error

selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read property '0' of undefined

I guess the object grecaptcha is called different in my case?

If I just execute the first comment (setting the response) and then submit the form by calling

driver.execute_script("document.getElementById('gs_captcha_f').submit()';")

I get the error

selenium.common.exceptions.JavascriptException: Message: javascript error: Invalid or unexpected token

from python-anticaptcha.

davidwozabal avatar davidwozabal commented on June 18, 2024

I tried to get a reproducible captcha and came up with the following request

https://scholar.google.com/scholar?cites=12685256029779217548&as_sdt=2005&sciodt=0,5&hl=en&num=20

The argument num=20 produces a captcha for every call embedded in a site with a slightly different code than the captures I was facing before. However, if I could solve this, it would maybe be a start.

I tried adapting the code from recaptcha_selenium_callback.py and ended up with the following code

from selenium.webdriver.chrome.options import Options
from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask

request = 'https://scholar.google.com/scholar?cites=12685256029779217548&as_sdt=2005&sciodt=0,5&hl=en&num=20'
options = Options()
driver = Chrome(chrome_options=options)
driver.get(request)

api_key = '...'
site_key = '6LfwuyUTAAAAAOAmoS0fdqijC2PbbdH4kjq62Y1b'
client = AnticaptchaClient(api_key)
task = NoCaptchaTaskProxylessTask(request, site_key)
job = client.createTask(task)
job.join()
token = job.get_solution_response()

driver.execute_script(
        "document.getElementById('g-recaptcha-response').innerHTML='{}';".format(token)
    )
driver.execute_script("submitCallback('{}')".format(token))
result = driver.page_source

The code runs without any errors. However, the display in the browser window does not change and also the variable result still contains the captcha page.

Where did I go wrong?

from python-anticaptcha.

ad-m avatar ad-m commented on June 18, 2024

@davidwozabal , could you provide code to reproduce captcha challenge? I do not receive the captcha challenge at the address provided. If I receive such a code - I will be able to analyze the problem more effectively.

from python-anticaptcha.

davidwozabal avatar davidwozabal commented on June 18, 2024

The link

https://scholar.google.com/scholar?cites=12685256029779217548&as_sdt=2005&sciodt=0,5&hl=en&num=20

above produces a captcha challenge for me (even if I open it from a normal browser from different computers).

from python-anticaptcha.

fashan7 avatar fashan7 commented on June 18, 2024

please help me regarding this issue based on recaptcha

https://stackoverflow.com/questions/68877761/recaptcha-wasnt-solving-by-anticaptcha-plugin-in-selenium-python

from python-anticaptcha.

fashan7 avatar fashan7 commented on June 18, 2024

Found the solution for the problem
see #92

from python-anticaptcha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.