From: Ahmed A. <asa...@ya...> - 2014-01-21 10:33:39
|
Hi Charu, The error is "Cannot find function createNode in object [object", which happens when this method is not implemented. Please: - Use latest version (if not SVN one). - Provide complete case, for others to reproduce. - Use FF browser simulation, as it may give the Object type. Ahmed ________________________________ From: Charu Bashiyan <cha...@gm...> To: htm...@li... Sent: Tuesday, January 21, 2014 12:59 PM Subject: [Htmlunit-user] Unable to click on HtmlAnchor Hello, I am trying to click on a link on a website. I am able to isolate the anchor in the variable "selected". But I am unable to click on that anchor. Please advise how to click a anchor and get the resultant page. List anchors = ((HtmlPage)pageAfterLogin).getAnchors(); HtmlAnchor selected = null; for(int i = 0; i < anchors.size(); i++) { System.out.println(anchors.get(i)); if ( anchors.get(i).toString().contains("PasswordLink" )) { selected = (HtmlAnchor)anchors.get(i); } } System.out.println( " selected = " + selected ); Page pageafterclick = selected.click(); // Getting the exception here. System.out.println("--------------------------------------------"); System.out.println(" pageafterclick = "); I am getting a huge Exception , part of that exception pasted below . -------------------------------------- [testng] ======= EXCEPTION START ======== [testng] EcmaError: lineNumber=[64] column=[0] lineSource=[null] name=[TypeError] sourceName=[http://adc21.dummy.com:7036/abc/afr/partition/ie/n/default/opt/core-11.1.1.7.0-3309.js] message=[TypeError: Cannot find function createNode in object [object]. (http://machinename.us.dummy.com:7036/abc/afr/partition/ie/n/default/opt/core-11.1.1.7.0-3309.js#64)] [testng] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function createNode in object [object]. (http://machinename.us.dummy.com:7036/abc/afr/partition/ie/n/default/opt/core-11.1.1.7.0-3309.js#64) [testng] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:526) [testng] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529) [testng] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536) [testng] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:456) [testng] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:925) [testng] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:182) [testng] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:200) [testng] at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:609) [testng] at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:886) [testng] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529) [testng] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536) [testng] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:891) [testng] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1237) [testng] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1208) [testng] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1177) [testng] at dummy.oam.fiat.passwordpolicy.PasswordPolicy.accessResource(PasswordPolicy.java:687) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [testng] at java.lang.reflect.Method.invoke(Method.java:597) [testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76) [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:673) . |