I have been trying to send a text to a text field that has the changing element id=PolarisTextField83
each time a log into a page (PolarisTextField## keeps changing its value like id=PolarisTextField45
) as I have found that the id element is dynamic and the only static and unique part of the HTML is the placeholder example text which is placeholder="e.g. Shirts"
.
Therefore, I wonder if there is a way of locating placeholder="e.g. Shirts"
then sending text to its respective type field (PolarisTextField##)?
I have tried to use
driver.findElementsByTagName("e.g. Shirts").sendKeys("test text");
but came to the understanding that I cannot follow .sendKeys()
after findElementsByTagName
.
I am new to both java and selenium and would appreciate any help and/or guidance!!