当我使用此代码导航根链接时”https://www.aliexpress.com/?language=en®ion=US”使用chromedp。Aliexpress将我重定向到阿拉伯语页面。
我需要直接进入英文页面
这是我正在使用的代码:
err := chromedp.Run(ctx,
chromedp.EmulateViewport(1920, 1980),
// Navigate to AliExpress with English language and US region
chromedp.Navigate(`https://www.aliexpress.com/?language=en®ion=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)
}
如果需要先添加一些标题,请帮助我