Search code examples
javascriptautomationprotractorui-automationinspector

While automating using html code to locate element by id to send keys some values are changing in each refresh in the site


While automating using html code to locate elements by id to send keys some values are changing in each refresh in the siteWhile automating using html code to locate element by id to send keys some values are changing in each refresh in the site. For example Username has input_0 and password input_1 and after refreshing or make the login the go back to login screen the value is increased !

Is there a way that we can make it always by default (not increased).

Here are 2 example to understand what i'm talking about username in the first one is input_0 (the origin) and in the other is input_4 (for the same field) problem origin problem


Solution

  • I have used tagName instead of Id in order to locate element to make automation.