Below is the code snippet I'm using in Selenium with JavaScript. In the final step, I want to retrieve any error codes from the browser console and specifically check for the absence of any 504 error codes on the current page.
driver.get(M_URL)
.then(() => {
return driver.findElement(By.xpath('//input[@id="UserName"]'))
.then(el => el.sendKeys(USERNAME));
})
.then(() => {
return driver.findElement(By.xpath('//input[@id="Password"]'))
.then(el => el.sendKeys(PASSWORD));
})
.then(() => {
return driver.findElement(By.xpath('//button[text()="Login"]'))
.then(el => el.click());
})
.then(() => {
return driver.findElement(By.xpath('//h3[text()[contains(.,"Publisher")]]')).click()
.then(() => log('Publisher page is rendered'));
})
.then(() => log('checking for a 504 error code in the browser console'));
Thank you in advance!