Menu

#161 Not able to close IE with embedded PDF

Version_2.0_beta1
open
5
2012-09-15
2009-08-13
No

Hi

We have been have problem in closing a browser which has pdf embedded. It
has come to point where this is the only thing it is stopping from complete
automation. It is frustrating that all i am trying to do is simple open and
close. I would be great if some one can help out.
I am using WatiN 1.3 Version. Below is how the soruce code looks like

<html>

<head>

ReportPackingSlip.aspx (application/pdf Object)

</head>

<body marginwidth="0" marginheight="0">

"<embed width="100%" height="100%" name="plugin" src=" &lt;a href=" http:="" staging.aut.com="" aut="" Reports="" ReportPackingSlip.aspx?"="">http://staging.aut.com/aut/Reports/ReportPackingSlip.aspx? Qry=UmVwb3J0TmFtZT1QYWNraW5nU2xpcCZPcmRTSUQ9NTkyMjA1JmNvcnBJZD0y-vB6LBNj3OGU%3d" type="application/pdf"/>"

</body>

</html>

My script

ie.Button("ctl00_ctl00_PageContent_ShippingContent_ReprintButton").Click();

IE PrintPkgSlips = IE.AttachToIENoWait(Find.ByUrl(new
Regex(".ReportPackingSlip.aspx.")));

PrintPkgSlips.Close(); <---------- Error occurs over here

System.InvalidCastException: Unable to cast COM object of type
'System.__ComObject' to interface type 'mshtml.IHTMLDocument2'. This
operation failed because the QueryInterface call on the COM component for
the interface with IID '{332C4425-26CB-11D0-B483-00C04FD90119}' failed due
to the following error: No such interface supported (Exception from HRESULT:
0x80004002 (E_NOINTERFACE)).
at WatiN.Core.IE.OnGetHtmlDocument()

I have tried all combination of ClickNoWait,AttacheToIE,Dispose also.

I have also tried using Watin 2.0 beta. The behavior is every different
when i use this version. It does not give the above error, gives a diffent
error at AttachToIENoWait stating that it is not able to find the url. Below
is the error

WatiN.Core.Exceptions.IENotFoundException: Could not find an IE window
matching constraint: Attribute 'href' matches '.ReportPackingSlip.aspx.'.
Search expired after '30' seconds.
at WatiN.Core.IE.FindIE(Constraint findBy, Int32 timeout, Boolean
waitForComplete)
at WatiN.Core.IE.AttachToIENoWait(Constraint findBy)

I think the attachtoIE is not working in Watin2.0 Beta. I have tried this
in both IE6 and IE7.

Thanks in advance. It would if some one could help we have been facing this
problem for a long time.

Regards
Thirukumaran

Discussion


Log in to post a comment.