My code:

package com.webdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;


public class TestWikipedia {

    public static void main(String[] args) throws InterruptedException {
        // TODO Auto-generated method stub
     WebDriver driver = new FirefoxDriver();
     driver.get("http://www.wikipedia.com");
     WebElement link;
     link =driver.findElement(By.partialLinkText("English"));
     link.click();
     WebElement searchBox;
     searchBox =driver.findElement(By.id("SearchInput"));
     searchBox.sendKeys("Software");
     searchBox.submit();
     Thread.sleep(3000);
     driver.quit();

Error Log:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"SearchInput"} Command duration or timeout: 382 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58' System info: host: 'Bharat.local', ip: '192.168.0.7', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.8.0_151' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=46.0, platform=MAC, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 92c5544c-358d-0444-8c68-ad4d2b834d06 *** Element info: {Using=id, value=SearchInput} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363) at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:413) at org.openqa.selenium.By$ById.findElement(By.java:218) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355) at com.webdriver.TestWikipedia.main(TestWikipedia.java:19) Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"SearchInput"} For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58' System info: host: 'Bharat.local', ip: '192.168.0.7', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.8.0_151' Driver info: driver.version: unknown at .FirefoxDriver.prototype.findElementInternal_(file:///var/folders/7m/q5ljmg551fjbld41j5z5_x600000gp/T/anonymous2176535614827261367webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10770) at .FirefoxDriver.prototype.findElement(file:///var/folders/7m/q5ljmg551fjbld41j5z5_x600000gp/T/anonymous2176535614827261367webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10779) at .DelayedCommand.prototype.executeInternal_/h(file:///var/folders/7m/q5ljmg551fjbld41j5z5_x600000gp/T/anonymous2176535614827261367webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12661) at .DelayedCommand.prototype.executeInternal_(file:///var/folders/7m/q5ljmg551fjbld41j5z5_x600000gp/T/anonymous2176535614827261367webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12666) at .DelayedCommand.prototype.execute/<(file:///var/folders/7m/q5ljmg551fjbld41j5z5_x600000gp/T/anonymous2176535614827261367webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12608)

New contributor
Yogesh Patil is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Your locator Id might have multiple matches so try using different locators for locating an element. – shanila Oct 11 at 7:27

You need to change

searchBox =driver.findElement(By.id("SearchInput"))

to

searchBox =driver.findElement(By.id("searchInput"))

(lowercase "s").

  • I have resolved this issues fallow this steps – Yogesh Patil Oct 11 at 7:36
  • Feel free to accept my answer, then :) – Mate Mrše Oct 11 at 7:37
  • Yogesh, you should mark this as the accepted answer, and perhaps also upvote his answer. – Bill Hileman Oct 11 at 13:51

Your Answer

Yogesh Patil is a new contributor. Be nice, and check out our Code of Conduct.
 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.