Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Quality Assurance

Magdalena Frankowska
Magdalena Frankowska
15,501 Points

Xpath not working

Every time I try to run the application I get these errors. It seems like xpath doesn't want to work with me. Where is the issue ?

DevTools listening on ws://127.0.0.1:60161/devtools/browser/76092154-22f4-4d59-ab1f-3e852c047a4b [13264:3396:1114/180638.294:ERROR:shader_disk_cache.cc(257)] Failed to create shader cache entry: -2 (node:1360) UnhandledPromiseRejectionWarning: NoSuchElementError: no such element: Unable to locate element: {"method":"xpath","selector":"//span[text() = "David Reisz"]/.."} (Session info: chrome=70.0.3538.102) (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) at Object.checkLegacyResponse (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\error.js:585:15) at parseHttpResponse (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\http.js:533:13) at Executor.execute (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\http.js:468:26) at process._tickCallback (internal/process/next_tick.js:68:7) (node:1360) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:1360) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:1360) UnhandledPromiseRejectionWarning: NoSuchElementError: no such element: Unable to locate element: {"method":"xpath","selector":"//span[text() = "Jennifer Nordell"]/.."} (Session info: chrome=70.0.3538.102) (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) at Object.checkLegacyResponse (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\error.js:585:15) at parseHttpResponse (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\http.js:533:13) at Executor.execute (C:\Users\magda\Desktop\Projects\selenium-basics\node_modules\selenium-webdriver\lib\http.js:468:26) at process._tickCallback (internal/process/next_tick.js:68:7) (node:1360) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

1 Answer

Hey....when picking elements, its good to test them in 'browser console' first before using them in your code. it gives you assurance that you picked the right elements before using them. Also, note that ids and css selectors are more preferred than xpath. Xpath makes the system heavy, and also will not work if an element is changed.