2014-10-16 88 views
0

我在我的Java应用程序中有一个嵌入式SWT浏览器。我想在此浏览器中直接登录到我的gmail帐户,并给出用户名和密码。我不想在浏览器中看到登录页面,我想直接转到邮件。这是可能的吗?我设置的URL是什么?它可能通过JavaScript的帮助?如何在SWT浏览器中登录Gmail帐户?

import org.eclipse.swt.SWT; 
import org.eclipse.swt.browser.Browser; 
import org.eclipse.swt.layout.FillLayout; 
import org.eclipse.swt.widgets.*; 


public class Dummy2 { 

    public static void main(String args[]) 
    { 
     Display display = new Display(); 
     Shell shell = new Shell(display); 

     shell.setLayout(new FillLayout()); 

     Browser b= new Browser(shell,SWT.NONE); 

     b.setUrl("www.Gmail.com"); 
     //b.setText("<html><body> Helllooooooooooooo </body></html>"); 

     shell.open(); 
     while (!shell.isDisposed()) { 
      //while (BGTrayApp.isOpen) { 
       if (!display.readAndDispatch()) 
        display.sleep(); 
      } 


    } 



} 

回答

0

有没有我自己做到了这一点,但可能增加验证监听器是要走的路:我怀疑这是可能的 SWT Browser help

0

,它肯定不可取。 Google可能会内置防护措施来防止这种情况发生,因为它可以更轻松地进行中间人攻击。另外,您如何处理启用双因素验证(Google身份验证器)的帐户?在这些情况下,在提交登录表单后,系统会要求您输入令牌。

为什么你需要这样做?你有没有考虑过其他的选择

相关问题