Browser4 icon indicating copy to clipboard operation
Browser4 copied to clipboard

Can I install browser plugins like 2Captcha to solve captchas?

Open willowypanda opened this issue 1 year ago • 1 comments

If so, how can I do it in PulsarRPA? Thanks!

willowypanda avatar Jul 26 '24 03:07 willowypanda

Sure! You can add an event handler to check and resolve captchas:

Here is a simple demo:

    fun options(args: String): LoadOptions {
        val options = session.options(args)

        val be = options.event.browseEventHandlers

        be.onDocumentActuallyReady.addLast { page, driver ->
            // Check if the page shows captchas here
            // If the captcha appears, call 2Captcha
        }

        return options
    }

    val url = "https://www.amazon.com/dp/B0C1H26C46"
    val args = "-refresh"
    session.load(url, options(args))

source code: https://github.com/platonai/PulsarRPA/blob/4900e8911c6d500cd3bf8d4512e7c3a689894caf/pulsar-app/pulsar-examples/src/main/kotlin/ai/platon/pulsar/examples/_7_RPA.kt

For all available event handlers, see:

https://github.com/platonai/PulsarRPA/blob/4900e8911c6d500cd3bf8d4512e7c3a689894caf/pulsar-app/pulsar-examples/src/main/kotlin/ai/platon/pulsar/examples/_6_EventHandler.kt

platonai avatar Aug 01 '24 01:08 platonai