Code 1:
element(by.id(\'myButtonId\')).click();
return element(by.id(\'myValidationSummaryId\')).getText().then(function (val) {
return val;
I was able to resolve this issue by adding a sleep. Given User is on the "xxx" page, when User clicks on "431511" site and User clicks on "DisplayMenu" and User clicks on "Create Device", then CREATE DEVICE form is displayed.
When('User clicks on {string}',async (string)=>{
if(string==="DisplayMenu"){
**await browser.sleep(3000);**
await TMS.displayMenu.click();}
else if (string==="CreateDevice"){
await TMS.createDevice.click();
}