RE: Unable to assign id properties to a known id type on my website (HTML based) for selenium based web tests


I have tried to use the following line of code while setting up for selenium webdriver GUI tests for my website

WebElement UserName = driver.findElement(“UserName”));

The goal with these lines is to basically assign a username nafis 123 to the username field in the website

However, I repeatedly get the following error

Exception in thread “main” org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:”id”,”selector”:”UserName”}
(Session info: chrome=50.0.2661.94)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
For documentation on this error, please visit:
Build info: version: ‘2.53.0’, revision: ’35ae25b’, time: ‘2016-03-15 16:57:40’

I have tried to look up the html file in my website. It hasn’t been so helpful in providing any ideas to map the correct category for user name field.

I would appreciate if anyone can help me with this ? Thank you


Hi Nafis
try this as username field dont have an is assigned to it
WebElement UserName = driver.findElement(“UserCode”));

on May 9, 2016.
Add Comment
2 Answers

It seems you are missing the basic chapters of selenium. You have to read on it and you can start from here

Professor Answered on May 8, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.