Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
Getting problem with webdriver main method

Solved 1 Answers 65 Views Programming
0 1
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":".//*[@id='gs_htif0']"}
Command duration or timeout: 31 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'INVZVCPC01688', ip: '172.26.2.174', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=37.0, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: d2c320be-e9d8-433f-b464-bf3a745fc11a
*** Element info: {Using=xpath, value=.//*[@id='gs_htif0']}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
    at gg.google.main(google.java:17)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":".//*[@id='gs_htif0']"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'INVZVCPC01688', ip: '172.26.2.174', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: unknown
    at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/DS0035~1/AppData/Local/Temp/anonymous1903139412827835983webdriver-profile/extensions/[email protected]com/components/driver-component.js:10271)
    at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/DS0035~1/AppData/Local/Temp/anonymous1903139412827835983webdriver-profile/extensions/[email protected]/components/driver-component.js:10280)
    at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/DS0035~1/AppData/Local/Temp/anonymous1903139412827835983webdriver-profile/extensions/[email protected]/components/command-processor.js:12274)
    at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/DS0035~1/AppData/Local/Temp/anonymous1903139412827835983webdriver-profile/extensions/[email protected]/components/command-processor.js:12279)
    at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/DS0035~1/AppData/Local/Temp/anonymous1903139412827835983webdriver-profile/extensions/[email protected]/components/command-processor.js:12221)

1 Answer

0
Best answer
0

It looks like the way you're identifying element is wrong. Please post your HTML code so we can answer your question.

 

 

PS: I believe your xpath is wrong.

 

answered by
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...