user6323432 user6323432 - 2 years ago 132
Java Question

Often receiving NoSuchElementException while running Selenium test cases

org.openqa.selenium.NoSuchElementException: Unable to find element with name == q (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 395 milliseconds
For documentation on this error, please visit:
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 15:28:49'
System info: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_01'
Driver info: driver.version: RemoteWebDriver
Session ID: e20f8370-00ed-4bf6-a4fa-a0c09c2b6d8c
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.openqa.selenium.remote.ErrorHandler.createThrowable(
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(
at org.openqa.selenium.remote.RemoteWebDriver.execute(
at org.openqa.selenium.remote.RemoteWebDriver.findElement(
at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(
at org.openqa.selenium.By$ByName.findElement(
at org.openqa.selenium.remote.RemoteWebDriver.findElement(

Answer Source

Yes this is common issue when you use IE.

Open regedit.exe

Open HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones

So Zones will contain 0,1,2,3,4 and on right hand side three columns will be visible as soon as you click on 0 i.e. Name Type Data

Now in Name column look for 2500 Double click it. Put Value data as 3 and Base as Hexadecimal

You did this for 0.

Now repeat the same steps for 1,2,3,4..

Do this for all i.e. 0,1,2,3,4,5 => Change all 2500's value data to 3.

After that run this code.

public static void main(String[] args) throws InterruptedException {

System.setProperty("", "D:\\Selenium\\CP-SAT\\IEDriver\\IEDriverServer.exe");

WebDriver driver = new InternetExplorerDriver();

It will run on IE. You need a IEDriverServer.exe as i have shown in path, which will run your IE browser.

Reply to me for further query. I ran the above code in eclipse and it ran successfully.

Happy learning :-)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download