admin管理员组

文章数量:1416651

when i use this code to navigate a root link "/?language=en&region=US" using chromedp. Aliexpress redirect me to the arabic page.

i need to get to directly to the english page

this is the code that i'm using :

err := chromedp.Run(ctx,
    chromedp.EmulateViewport(1920, 1980),
    // Navigate to AliExpress with English language and US region
    chromedp.Navigate(`/?language=en&region=US`),
    chromedp.WaitVisible(`body`, chromedp.ByQuery),
    chromedp.Sleep(5*time.Second), // Wait for the page to fully load
    // Extract all links with their text and href
    chromedp.Evaluate(`
        JSON.stringify(
            Array.from(document.querySelectorAll('a')).map(a => ({
                text: a.textContent.trim(),
                href: a.href
            }))
        )
    `, &links),
)
if err != nil {
    log.Fatal(err)
}

if there is away to add some header first please help me

本文标签: goheadless browser using chromedp from scraping aliexpressStack Overflow