Reputation: 2703
i'm trying to switch for another frame (With no name or id) but getting Exception.
object index = 0;
var frame = (mshtml.IHTMLWindow2)workDocument.frames.item(ref index);
frameDocument = (mshtml.IHTMLDocument2)frame.document; // Exception.
Tried other way but the same exception:
webBrowser.Document.Window.Frames[0].Document.GetElementById("userName").SetAttribute("value", username);
webBrowser.Document.Window.Frames[0].Document.GetElementById("userPassword").SetAttribute("value", password);
webBrowser.Document.Window.Frames[0].Document.GetElementById("login").InvokeMember("click");
Exception:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
i understand that is a cross-domain reason, do we have solution for that cases
Thank's
Upvotes: 3
Views: 1072
Reputation: 15271
you can catch and ignore the exception, or tweak the security settings to allow cross-domain scripting:
Upvotes: 2