I need to create a testing automation tool in selenium with c# to test the website of my company. Everything works fine, except one thing: everytime when I reload a task on the website (like "create new user"), the XPath of some fields change. The first name field is as example not "//*[@id=\"0FirstName\"]" anymore, the new xpath would be "//*[@id=\"2FirstName\"]" and selenium does not recognize that field anymore like before -> program stops working
Is there a way to make a dynamic function to ignore the number before the email?
driver.FindElement(By.XPath("//*[@id=\"0FirstName\"]")).SendKeys("Selenium");