0

I am automating a portion of a website that kicks off a job when you click a button. The status of the job is reported on the page in another field, but it isn't automatically pushed. The end user needs to click a Refresh button inside the page to see the latest status.

Something like this

browser.expect.element('@status').text.to.equal('Done').before(10000);

would work if the data was pushed without using interaction, but since I have to manually click another button to get the latest status that wouldn't work.

Is there a built in method to do something every [interval here] until [condition true] or [timeout reached] in Nightwatch? I don't want to use a hard pause since the job could take more or less time depending how the server is feeling.

EdgeCase
  • 135
  • 2
  • 12

1 Answers1

0

By another field do you mean an iFrame, svg or perhaps another tab/window? You don't need manually, there is an option to switch to a different window with the following:

Window Handles + SwitchTo:

command(windowNum){
   const result = browser.windowHandles();
   let handle = result.value[windowNum];
   browser.switchWindow(handle);
}

Refresh a page

browser.refresh();

I don't believe there is a built in method in Nightwatch but I'm sure you can use a for loop and an if statement