microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.1k stars 3.61k forks source link

[Bug]: #32848

Closed zhanglijie123 closed 1 week ago

zhanglijie123 commented 1 week ago

Version

1.44.0

Steps to reproduce

following is my example,but page not action or happen exception of 'Element is outside of the viewport' when click next page-button. (remark:please use china-area proxy)

public static void main(String[] args) { List arg = ListUtil.toList( "--disable-blink-features=AutomationControlled"

    );
    try (Playwright playwright = Playwright.create();

         Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
                 .setHeadless(false).setArgs(arg))
    ) {

        BrowserContext context = browser.newContext();

        Page page = context.newPage();
        page.navigate("https://www.yhfund.com.cn/main/annuity/pensionprod/baqrgg/index.shtml");
        Locator locator = page.locator("xpath=" + "//*[@id="next_page"]").first();
        Locator.ClickOptions clickOptions = new Locator.ClickOptions();
        clickOptions.setButton(MouseButton.LEFT);
        clickOptions.setClickCount(1);
        clickOptions.setTimeout(10000);
        clickOptions.setForce(true);
        locator.click(clickOptions);

        Thread.sleep(10000000);

    } catch (InterruptedException e) {
        e.printStackTrace();
    }

Expected behavior

expect to next page(page 2) 2

Actual behavior

No response, still on the homepage。 image ![Uploading 1.png…]()

Additional context

No response

Environment

System:
  os:win10
  playwright-version:1.44.0
yury-s commented 1 week ago

Looks like some bot protection kicks in on the server, I'm getting 'Failed to load resource: the server responded with a status of 521 ()' when running this code. Try recording a trace to debug what's going on. If you think this is a bug in playwright, please file a new issue and attach a self-contained reproduction that wouldn't depend on the behavior of third-party servers.