Need to Change URL during the test

I have a test that visits a page, performs an action and then needs to navigate to a new URL using goto. The second goto takes the browser to the new url but the page object stops interacting with the elements of the page. Any help is much appreciated

Hi @Jeet_S!

Could you clarify what do you mean with “the page object stops interacting with the elements of the page”?

Also, could you provide the script code that you are running please? Or, if the website that you are testing is not public, a similar test that reproduces the problem or at least one example with which we can more easily understand what is the script intention and where might be the problem located at?

Thank you.

the site is not public, but the scenario goes seomething like:

   try {
        // Navigate to 1st Homepage
        await page.goto('https://www.website.org', {waitUntil: 'networkidle'});
        await Promise.all([
            page.waitForLoadState(),
            page.locator('#onetrust-accept-btn-handler').click(),
        ]);
        check(page, {
            'some value that should exist': page.locator(locator').textContent().includes('Expected VAlues')
        });


        await page.goto('https://www.website2.org/action/showLogin', {waitUntil: 'networkidle'});
        check(page, {
        'loginPageHeader': newPage.locator('#content > div').textContent().includes('Log in')
        // });

        // Enters Username and Password
        page.locator('//*[@id="id_login"]').type("testing@mailinator.com");
        page.locator('//*[@id="id_password"]').type("testing@mailinator.com");

        // Clicks login and waits for Homepage to load
        await Promise.all([
            newPage.locator('//*[@id="login-form"]/personalization-ui-button').click(),
            newPage.waitForNavigation(),
        ]);
        check(page, {
            'logged in. now': newPage.locator('#content >.main-heading').textContent().includes(expected value')
        });
    } catch (e){
        console.log('message', e.message);
    } finally {
        page.close();
        browser.close();
    }
}

The second GOTO works to redirect the browser but all interaction stops working. Cant enter credentials anymore