HtmlUnit Java按钮单击警告

HtmlUnit Java按钮单击警告,java,javascript,html,warnings,htmlunit,Java,Javascript,Html,Warnings,Htmlunit,我试图写一个程序,我可以登录到我的mlg帐户。我在用它。这是我的密码: import java.net.*; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftwa

我试图写一个程序,我可以登录到我的mlg帐户。我在用它。这是我的密码:

import java.net.*;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.IOException;
import org.apache.commons.logging.LogFactory;


public class test {


        public static void main(String... args) throws FailingHttpStatusCodeException, MalformedURLException, IOException{

            //supress first warnings
            java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.OFF);
            java.util.logging.Logger.getLogger("org.apache.http").setLevel(java.util.logging.Level.OFF);
            LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");

            WebClient webClient = new WebClient(BrowserVersion.CHROME);
            webClient.getOptions().setJavaScriptEnabled(true);
            webClient.getOptions().setThrowExceptionOnScriptError(false);

            HtmlPage page = webClient.getPage("https://accounts.majorleaguegaming.com/");

            HtmlForm form = page.getForms().get(0);

            System.out.println(page.getTitleText());
            //Edited my username & Password
            form.getInputByName("login").setValueAttribute("MYUSERNAME");
            form.getInputByName("password").setValueAttribute("MYPASSWORD");

            HtmlElement button = form.getInputByName("commit");

            page = button.click();

            System.out.println("AFTER CLICK");
            System.out.println(page.getTitleText());
            System.out.println(page.asText());

    }
}
我测试了代码,它运行得很好,但我收到了这些警告,这使得程序运行非常缓慢:

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getTabIndex() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getTabIndex() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setTabIndex(int) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getTabIndex() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setTabIndex(int) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOuterHTML() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOuterHTML() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setOuterHTML(java.lang.String) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOuterHTML() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setOuterHTML(java.lang.String) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getChildren() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getChildren() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getChildren() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getLang() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getLang() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setLang(java.lang.String) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getLang() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.setLang(java.lang.String) of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getScrollWidth() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getScrollWidth() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public int com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getScrollWidth() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getId() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object public java.lang.String com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getId() of class net.sourceforge.htmlunit.corejs.javascript.MemberBox where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
...i deleted the rest
我相信这条线

page = button.click();
这是发出警告的原因。有人能帮我吗?我还应该用别的东西吗?或者有人知道如何压制警告吗


谢谢:)

它们看起来像是JS警告。很可能是因为JS引擎不喜欢代码的某些部分。如果过程正常,则忽略它们


如果你想关闭它们,它们很可能会离开我对这个问题的回答(你只需添加两行):

谢谢你的回答。我添加了这些行,但没有改变任何东西。我收到了与以前相同的警告:/I我还认识到,按钮单击不会像我想象的那样工作。因此,没有关于如何修复它的任何信息,因为错误在JS代码中,您无法触摸服务器的代码。或者,Rhino可能有一个bug,或者对JS正在做的任何事情都缺乏支持。在任何情况下,我已经给出了一些其他可能help@MostyMostacho你有没有找到关闭犀牛警告的解决方案?你有没有找到关闭犀牛警告的解决方案?那其实是安静的一段时间前,但我记得我没有找到解决办法。