0

I'm working under AWS VPN connection and when I try simple page navigation to site that is under AWS VPN connection using playwright JAVA code, I'm getting timeout and the page navigation is not opening the site.

If I do it manually using Chrome browser under active AWS VPN connection the site is opening. all is good.

I wonder if the reason is that PW is launches the browser in Incognito mode , but I also tried using non Incognito mode but still under AWS VPN the site is not opening ? strange do you have any idea how to solve this?

see this is my simple code that is running under VPN

    Playwright playwright = Playwright.create();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = (int)screenSize.getWidth();
    int height = (int)screenSize.getHeight();

    Path userDataDir = Paths.get(System.getenv("LOCALAPPDATA"),"\\Google\\Chrome\\User Data", "");

    BrowserType.LaunchPersistentContextOptions browserOptions = new BrowserType.LaunchPersistentContextOptions();
    browserOptions.setHeadless(false);
    browserOptions.setChannel("chrome");
    browserOptions.setTimeout(120000);
    browserOptions.setViewportSize(width,height);

    BrowserContext browserContext = playwright.chromium().
            launchPersistentContext(userDataDir,browserOptions);

    Page page = browserContext.newPage();
    page.setDefaultTimeout(120000);
    page.setDefaultNavigationTimeout(120000);

    page.navigate(url);   // in this line the browser is stuck and wait and wait ...  

    
    page.locator("input#username").fill(username);
    page.locator("input#password").fill(password);
    page.locator("button[type='submit']").click();

0 Answers0