I am trying to navigate to the url which contains #
in the url which is returning Error: Navigation Timeout Exceeded: 30000ms exceeded
it('should go to new link', async function(){
await page.goto('https://example.com/#/abc', {waitUntil: 'networkidle2'})
await page.waitForNavigation()
await page.waitFor(15000);
})
Original code expects a path to a tag having value as #/abc
await page.waitForSelector('a tag selector')
await page.click('a tag selector')
await page.waitForNavigation()
await page.waitFor(5000);
await page.screenshot({ path: 'abc.png' })
Running the test file with command mocha --timeout 75000
package.json
"devDependencies": {
"chai": "^4.1.2",
"karma": "^2.0.3",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-requirejs": "^1.1.0",
"mocha": "^5.2.0"
},
"dependencies": {
"puppeteer": "^0.12.0",
"requirejs": "^2.3.5"
}
Updated the code to
await page.goto('https://example.com/#/abc', {waitUntil: 'load'})
await page.waitForSelector('selector on desired page');
await page.waitFor(5000);
await page.screenshot({ path: 'abc.png' })
and added headless: false
, I can see it does go to the page wait for some amount of time but still throw the error Error: Navigation Timeout Exceeded: 30000ms exceeded