I am getting following error:-
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element with name: q
name:q exists in google browser. It is a text or input field. Following is the excample code snippet i am using:-
public class Example
public static void main(String args)
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
// Now submit the form. WebDriver will find the form for us from the element
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
Kindly let me know the solution for this.
Try with firefox , It may work for you.
What are the version you are using , java IDE and Webdriver?
As far as I can tell that should work.
Yes , code has no issue.
The only issue can be the non compatibility among the bits.
IE and chrome may need setup for your automation. Firefox is the simplest you can try and let us know.
I am using IE7. Could you please let me know with IE7 what are the configuration files for selenium compatibilty?