Sto utilizzando C#, vinci app, cercando di fare clic su un pulsante trovato in un iframe sul mio browser.Fare clic su Button in iframe nel controllo WebBrowser
HTML:
<iframe frameborder="0" scrolling="no" id="EditorIFrmae" name="EditorIFrmae" width="100%" height="700" style="z-index: 0; height: 852px;" src="X"></iframe>
Nel codice iframe:
<div height="" width="100%" style="position: relative; min-height: 50px;" onclick="javascript:funcEditPage('SB_Content_Page','SB_Content_PagePreview','PAGE5.asp');" class="SB_DivContentPreview" id="SB_Content_PagePreview">
</div>
Il mio codice:
HtmlElementCollection linkit = this.webBrowser1.Document.GetElementsByTagName("div");
foreach (HtmlElement foundit in linkit)
{
if (foundit.GetAttribute("id").Equals("SB_Content_PagePreview"))
{
foundit.InvokeMember("Click");
}
}
Come sono capace di fare clic sul pulsante?
domanda molto chiara. Qual è il problema essere più specifici –
@FarhanAnam - Sono sry non era abbastanza chiaro: Sto cercando di fare clic su un div che si trova in ifame e non sulla pagina curret. – Sagi
Il tuo codice sembra bene qual è il problema che stai affrontando? –