Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Hardcoded delays are only marginally better in that it is still waiting a fixed amount of time for the object to appear. "Wait" methods actually have a maximum wait time which you can set sufficiently high to allow for the tested component to appear before you try and click on it. For example, you could do something like the following:
This is assuming you're using name mapping and that the download dialog is mapped as an alias item. However, the point of it is to demonstrate that the above code will wait up to a full minute for the dialog box to be present. If the box shows up in less than a minute, say 20 seconds, the code will continue after 20 seconds rather than waiting the full minute. See http://smartbear.com/support/viewarticle/14496/ for more information on this.
Again, I'm guessing that this is the cause of your problem. Can you upload a screen shot of your log file results when the save button does not get properly clicked? Are there any errors that show up? If so, what does the "Additional Information" panel of the log have in it? It could be a completely different problem but without a log file, it's hard to say what exactly is going on and how to "fix" it.
var DownloadBox = Aliases.WaitAliasChild("DownLoadBox", 60000)
if (DownloadBox.Exists)
{
DownloadBox.SaveButton.ClickButton()
}
This is assuming you're using name mapping and that the download dialog is mapped as an alias item. However, the point of it is to demonstrate that the above code will wait up to a full minute for the dialog box to be present. If the box shows up in less than a minute, say 20 seconds, the code will continue after 20 seconds rather than waiting the full minute. See http://smartbear.com/support/viewarticle/14496/ for more information on this.
Again, I'm guessing that this is the cause of your problem. Can you upload a screen shot of your log file results when the save button does not get properly clicked? Are there any errors that show up? If so, what does the "Additional Information" panel of the log have in it? It could be a completely different problem but without a log file, it's hard to say what exactly is going on and how to "fix" it.