go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5k stars 328 forks source link

How do I get Ifram without using--disable-site-isolation-trials? #1076

Open m7rick opened 1 week ago

m7rick commented 1 week ago

Rod Version: v0.116.1

The code to demonstrate your question

func TestRod() {
        u := "ws://localhost:51268/devtools/browser/d7231f3d-56e0-4e7c-91d7-85a8da8820b7"
    log.Println(u)
    browser := rod.New().ControlURL(u).MustConnect()
        page := browser.MustPage("https://2captcha.com/demo/cloudflare-turnstile").MustWaitLoad()

    log.Println(page.MustInfo().Title)

    iframePage:= page.MustSearch(`iframe`).MustFrame()
    a := iframePage.MustHTML()
    log.Println(a)
    text := iframePage.MustElement("#challenge-stage > div > label > span.cb-lb-t").MustText()

    fmt.Println(text)
    iframePage.MustElement("#challenge-stage > div > label > input[type=checkbox]").MustClick()
}

What you got

panic: runtime error: invalid memory address or nil pointer dereference

What you expect to see

How do I get Ifram without using--disable-site-isolation-trials?

What have you tried to solve the question

chrome kernel: "Chrome/124.0.6367.223" Adding "--disable-site-isolation-trials" to the browser will solve the problem, but adding this parameter will cause cloudflare-turnstile to loop indefinitely

github-actions[bot] commented 1 week ago

Please fix the format of your markdown:

31:65 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
33 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## What have you tried to solve the question"]

generated by check-issue

ysmood commented 1 week ago

Even I remove the "--disable-site-isolation-trials" it will still fail to pass the bot detection, I think it's something else that blocks you. You'd better to research how cloudflare-turnstile works.

m7rick commented 1 week ago

Thank you

Longdexin commented 1 week ago

@m7rick remove --disable-site-isolation-trials anyway 2 and use the old fashion way here https://github.com/go-rod/rod/issues/548#issuecomment-1057731628