This question is locked. New answers and comments are not allowed.
Hi,
I have the test steps below:
-click “Add” link
- a pop-up window displays
-select some data on pop-up
-click “OK” link to close pop-up, then the data on pop-up will be reflected on main window
Currently my application under test behavior is after clicking “OK” link, a JavaScript is called to load the data in the pop-up to main window. In my test script, I used lnkOK.Click() command to stimulate the mouse click action but the JavaScript is not called (the data is not added from the pop-up to the main window). Therefore, I used the invoke script event to call the script as below:
<a id="ctl00_contentPlaceHolderMain_ctrlModifyView_lbtOK" class="lnkStyle" href="javascript:__doPostBack('ctl00$contentPlaceHolderMain$ctrlModifyView$lbtOK','')" onmouseout="ChangeBackgroundColorToYellow(this);" onmouseover="ChangeBackgroundColorToSilver(this);" title="OK" style="background-color: rgb(255, 255, 221);">OK</a>
lnkOK.Click()
lnkOK.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnClick)
By using the invoke script command, I get the data loading success. However, sometimes the execution test script occur error:
Error :ExecuteCommand failed!
InError set by the client. Client Error:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at mshtml.HTMLAnchorElementClass.IHTMLElement3_FireEvent(String bstrEventName, Object& pvarEventObject)
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, String data)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeEvent',Target:'ElementId (tagName: 'a',occurrenceIndex: '145')',Data:'onclick--@@--null',ClientId:'Client_b7dba0e7-48ea-4764-8958-b9e768c23add',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at mshtml.HTMLAnchorElementClass.IHTMLElement3_FireEvent(String bstrEventName, Object& pvarEventObject)
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, String data)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
How can I fix this problem?
Thanks in advance
I have the test steps below:
-click “Add” link
- a pop-up window displays
-select some data on pop-up
-click “OK” link to close pop-up, then the data on pop-up will be reflected on main window
Currently my application under test behavior is after clicking “OK” link, a JavaScript is called to load the data in the pop-up to main window. In my test script, I used lnkOK.Click() command to stimulate the mouse click action but the JavaScript is not called (the data is not added from the pop-up to the main window). Therefore, I used the invoke script event to call the script as below:
<a id="ctl00_contentPlaceHolderMain_ctrlModifyView_lbtOK" class="lnkStyle" href="javascript:__doPostBack('ctl00$contentPlaceHolderMain$ctrlModifyView$lbtOK','')" onmouseout="ChangeBackgroundColorToYellow(this);" onmouseover="ChangeBackgroundColorToSilver(this);" title="OK" style="background-color: rgb(255, 255, 221);">OK</a>
lnkOK.Click()
lnkOK.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnClick)
By using the invoke script command, I get the data loading success. However, sometimes the execution test script occur error:
Error :ExecuteCommand failed!
InError set by the client. Client Error:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at mshtml.HTMLAnchorElementClass.IHTMLElement3_FireEvent(String bstrEventName, Object& pvarEventObject)
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, String data)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeEvent',Target:'ElementId (tagName: 'a',occurrenceIndex: '145')',Data:'onclick--@@--null',ClientId:'Client_b7dba0e7-48ea-4764-8958-b9e768c23add',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at mshtml.HTMLAnchorElementClass.IHTMLElement3_FireEvent(String bstrEventName, Object& pvarEventObject)
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, String data)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
How can I fix this problem?
Thanks in advance