Handling delayed actions

I have trying to create an script to run a jenkins build and faced issues related to handling actions that are being delayed.

Here is the source code:

var uri = 'http://54.71.151.226/';

if (!uri) {
     uri = prompt("Enter your jenkins url");
}
open(uri);
var job_title = args[0]
if (!job_title) {
    job_title = prompt("provide  a valid name for your new job")
}
open(uri + "view/all/newJob")

type(job_title, "#name",{method: "by_query_selector"})
click(".hudson_model_FreeStyleProject", { method: "by_query_selector",   expectReload: true})
click("OK", {expectReload: true})

open(uri + "job/"+job_title+"/configure")
click('Save')

open(uri + "/job/"+job_title+"/")

Or you can test it here: https://play.workerb.io/s/a1TyZ

Hi @praveen-me there can be 2 possible reasons

  1. In this line you don’t need expectReload: true

click(".hudson_model_FreeStyleProject", { method: “by_query_selector”, expectReload: true })

The reason for that is expectReload assumes that page is going to reload and the script needs to stop execution and wait for page reload which is not the case here hence the script is paused and doesn’t proceed further.

  1. That open(uri + "job/"+job_title+"/configure") happens so fast that the click fails to complete this is something we will try to solve in the future but as of now we don’t have any way to detect if the click was successful or not.