Gmail-DIV与按钮-如何调用“点击"? [英] Gmail - DIV vs BUTTONS - How to invoke CLICK?

查看:119
本文介绍了Gmail-DIV与按钮-如何调用“点击"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用WebBrowserControl(C#)从GMAIL转发和发送电子邮件.

-我可以在WebBrowserControl上打开Gmail INBOX页面...
-我可以打开我需要转发的特定电子邮件(包括收件箱中的其他电子邮件)...
-我能够找到并单击FORWARD链接以开始使用电子邮件字段(TEXTS)...
-我可以添加/插入要发送给...的电子邮件.
-我能够添加/编辑电子邮件正文的内容...

但是,现在我已经完成了无法发送的电子邮件.我需要调用/单击发送"按钮,但Gmail使用DIV而不是按钮,常规的CLICK无效.

这是我到目前为止所做的.由于大多数DIV没有ID,因此我要遍历Gmail MAIN FRAME(canvas_frame)中的所有DIV....

I''m trying to FORWARD and email from GMAIL using the WebBrowserControl (C#).

-I am able to open the Gmail INBOX page on the WebBrowserControl...
-I am able to OPEN the specific email (among the others on the inbox) that I need to forward...
-I am able to find and click the FORWARD link to start working with the email fields (TEXTS)...
-I am able to add/insert the email that I would like to send TO...
-I am able to add/edit the content of the email body...

However, now that I am done with the email I CAN''T SEND IT. I need to invoke/click the SEND button but Gmail uses DIV instead of BUTTONS and the regular CLICK does not work.

This is what I did so far. Since most of the DIVs do not have ID, I iterate through all the DIVs inside the Gmail MAIN FRAME (canvas_frame)....

webIE.Document.Window.Frames["canvas_frame"].Document.Body.GetElementsByTagName( "div" );


...并且使用正则表达式,我能够找到包含需要单击的文本(SEND)的正确DIV.这是GMAIL如何封装HTML``SEND''BUTTON = DIV的示例(同样适用于大多数按钮,例如SAVE NOW,DISCARD等).


...and with a regular expression I was able to find the right DIV that contains the text(SEND) that I need to click. Here is the sample on how GMAIL encapsulates the HTML ''SEND'' BUTTON = DIV (the same apply to most of the buttons like SAVE NOW, DISCARD, etc).

<div id=":j5" class="J-K-I J-J5-Ji Bq L3" role="button" tabIndex="1" unselectable="on">
    <div class="J-J5-Ji J-K-I-Kv-H" unselectable="on">
        <div class="J-J5-Ji J-K-I-J6-H" unselectable="on">
            <div class="J-K-I-KC" unselectable="on">
                <div class="J-K-I-K9-KP" unselectable="on"> </div>
                <div class="J-K-I-Jz" unselectable="on">Send</div>
            </div>
        </div>
    </div>
</div>


我首先尝试在包含SEND文本的内部DIV上调用click(InvokeMember("click")):


I first tried invoking click ( InvokeMember("click") ) on the inner DIV containing the SEND text:

<div class="J-K-I-Jz" unselectable="on">Send</div>


...但是不幸的是没有用,然后我尝试调用上述HTML代码的所有DIV(父级/子级),完全没有运气.

关于如何发送电子邮件的任何想法/建议?

++感谢


...but unfortunately did not work, then I tried invoking click on all and any of the DIVs (Parent/Children) of the above HTML code with no luck at all.

Any IDEA/ADVICE on how can I get to SEND the email?

++Thanks

推荐答案

首先,这可能不是您期望的答案.

据我了解您的问题,您正在尝试自动化转发电子邮件的过程,不是吗?如果Google决定更改其布局,您在做什么?

我认为,如果您尝试通过IMAP连接到GMail帐户,查询要转发的邮件,下载并修改它,最后通过SMTP(通过Google Mail)重新发送,那会更好更好.

已经有一个 SMTP客户端 [一个 [ ^ ].我不知道是否还有其他人.

只是我的想法.
First of all, this is probably not the kind of answer you''d expect.

As far as I understand your problem, you''re trying to automate the process of forwarding an e-mail, isn''t it? What are you doing in case Google decides to change their layout?

In my opinion it would be better and hopefully easier if you''re trying to connect to your GMail account via IMAP, querying for the message you want to forward, download and modify it and finally resend it via SMTP (through Google Mail).

There is already a SMTP client[^] built into the .NET framework. Unfortunately you have to look for an external library which lets you browse your inbox via IMAP. I found this one[^]. I don''t know if there are others, probably yes.

Just my thoughts.


这篇关于Gmail-DIV与按钮-如何调用“点击"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆