Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchElementException: Returned node was not a DOM element #32

Closed
suziying opened this issue Dec 23, 2016 · 8 comments
Closed

NoSuchElementException: Returned node was not a DOM element #32

suziying opened this issue Dec 23, 2016 · 8 comments

Comments

@suziying
Copy link

It's wired that when i try to use htmluniter driver to click element. My code is below:

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

public class HtmlUnitDriverTest {
	
	@Test()
	public void testUnitDriver() throws InterruptedException {
		WebDriver driver = new HtmlUnitDriver();
		driver.navigate().to("http://x.x.x.x/#/home");
		driver.findElement(By.cssSelector("header.header--desktop.hidden-xs-down > div > div > div > a")).click();
	}
}

And i got below errors:

org.openqa.selenium.NoSuchElementException: Returned node was not a DOM element
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'William-MacBook-Pro.local', ip: 'x.x.x.117', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.2', java.version: '1.8.0_111'
Driver info: driver.version: HtmlUnitDriver
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByCssSelector(HtmlUnitDriver.java:1060)
	at org.openqa.selenium.By$ByCssSelector.findElement(By.java:430)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1725)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1721)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.implicitlyWaitFor(HtmlUnitDriver.java:1367)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:1721)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:606)
	at HtmlUnitDriver.test.HtmlUnitDriverTest.testUnitDriver(HtmlUnitDriverTest.java:14)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
@asashour
Copy link
Contributor

Please provide the URL, so others can investigate the error.

@suziying
Copy link
Author

http://10.0.1.26/#/home

@asashour
Copy link
Contributor

This is a local network address, which no one else can access.

@suziying
Copy link
Author

You can try this one:
www.airwallex.com

Thanks

@asashour
Copy link
Contributor

There is an error:

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "selfUpdatingLiveRates" is not defined. (https://www.airwallex.com/airwallex.js?3be306dad8eb5eda5b4e&ac491df1b7b812ac0118#35)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3915)

Please read http://htmlunit.sourceforge.net/submittingJSBugs.html

@suziying
Copy link
Author

Thanks @asashour , but i still don't get it I am using JAVA and why i got JS error ? For the error I posted above, I don't understand what's the meaning of "Returned node was not a DOM element"

@asashour asashour added bug and removed bug labels Jan 7, 2017
@rbri
Copy link
Collaborator

rbri commented Nov 21, 2017

Have added some details to the output, just in case someone is able to reproduce this.

@rbri
Copy link
Collaborator

rbri commented Aug 18, 2019

No new since ages, will close this.

@rbri rbri closed this as completed Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants