“Stale element reference” error behavior undestanding

前端 未结 2 1167
萌比男神i
萌比男神i 2021-02-09 04:52

Code 1:

element(by.id(\'myButtonId\')).click();
return element(by.id(\'myValidationSummaryId\')).getText().then(function (val) {
    return val;         


        
2条回答
  •  清歌不尽
    2021-02-09 05:45

    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();
          }
    

提交回复
热议问题