Devendra.dvm
10-30-2018, 11:05 PM
Hi Experts,
Iam working on a project ''Automation IE'' but got stucked at clicking on Image buttion ...
Im trying to spool one excel report from website and for the same i need to click on Generate button(type="submit") then one message will appear (Report Spooled Successfully) then only i can click on download button (type="image"). have attached screenshot below for reference
Screenshot
23106
Generate button HTML source code
<td align="right"> <input type="submit" name="ctl00$ContentPlaceHolder1$btnGenerate" value=" Generate " onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$btnGenerate", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder1_btnGenerate" tabindex="4" title="Click Here" class="dxbButton_Glass"></td>
Below is the HTML source code for message
<td colspan="2"> <span id="ctl00_ContentPlaceHolder1_lblMsg" style="color:Blue;font-weight:bold;">Report Spooled Successfully</span></td>
Below is The HTML source code for download button (type="image")
<td align="right" visible="false"> click here to Download
<input type="image" name="ctl00$ContentPlaceHolder1$lnkDownload" id="ctl00_ContentPlaceHolder1_lnkDownload" tabindex="7" title="Download" src="../../Images/save.gif" alt="Download" style="border-width:0px;"> </td>
With my code i am able to click on Generate button but facing difficulty clicking on Download button after message appeared, have tried to looping until condition is met and tried if Element.innertext = message but no luck.
Below is the My VBA code
Sub KBOSS_Brokerage_Process_Status()
Set Browser = CreateObject("internetexplorer.application")
Browser.Visible = false
Browser.navigate ("my url")
Set mymsg = Browser.document.getElementById("ctl00_ContentPlaceHolder1_lblMsg")
For Each elem In mymsg.getElementsByTagName("span")
If elem.innerText = " Report Spooled Successfully " Then Exit For
Next elem
Browser.document.getElementById("ctl00_ContentPlaceHolder1_lnkDownload").Click
Browser.Quit
Set Browser = Nothing
End Sub
Any help greatly appreciated.
thanks in advance.
Cross post: https://chandoo.org/forum/threads/vba-code-to-select-an-option-from-html-drop-down-using-value-rather-than-index.37707/#post-228291
https://stackoverflow.com/questions/53077142/v-b-a-code-to-click-on-image-button-in-ie
Iam working on a project ''Automation IE'' but got stucked at clicking on Image buttion ...
Im trying to spool one excel report from website and for the same i need to click on Generate button(type="submit") then one message will appear (Report Spooled Successfully) then only i can click on download button (type="image"). have attached screenshot below for reference
Screenshot
23106
Generate button HTML source code
<td align="right"> <input type="submit" name="ctl00$ContentPlaceHolder1$btnGenerate" value=" Generate " onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$btnGenerate", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder1_btnGenerate" tabindex="4" title="Click Here" class="dxbButton_Glass"></td>
Below is the HTML source code for message
<td colspan="2"> <span id="ctl00_ContentPlaceHolder1_lblMsg" style="color:Blue;font-weight:bold;">Report Spooled Successfully</span></td>
Below is The HTML source code for download button (type="image")
<td align="right" visible="false"> click here to Download
<input type="image" name="ctl00$ContentPlaceHolder1$lnkDownload" id="ctl00_ContentPlaceHolder1_lnkDownload" tabindex="7" title="Download" src="../../Images/save.gif" alt="Download" style="border-width:0px;"> </td>
With my code i am able to click on Generate button but facing difficulty clicking on Download button after message appeared, have tried to looping until condition is met and tried if Element.innertext = message but no luck.
Below is the My VBA code
Sub KBOSS_Brokerage_Process_Status()
Set Browser = CreateObject("internetexplorer.application")
Browser.Visible = false
Browser.navigate ("my url")
Set mymsg = Browser.document.getElementById("ctl00_ContentPlaceHolder1_lblMsg")
For Each elem In mymsg.getElementsByTagName("span")
If elem.innerText = " Report Spooled Successfully " Then Exit For
Next elem
Browser.document.getElementById("ctl00_ContentPlaceHolder1_lnkDownload").Click
Browser.Quit
Set Browser = Nothing
End Sub
Any help greatly appreciated.
thanks in advance.
Cross post: https://chandoo.org/forum/threads/vba-code-to-select-an-option-from-html-drop-down-using-value-rather-than-index.37707/#post-228291
https://stackoverflow.com/questions/53077142/v-b-a-code-to-click-on-image-button-in-ie