How to find a dynamic element using selenium webdriver? -



How to find a dynamic element using selenium webdriver? -

i want locate element id in webpage text field come in name. element :

the first time, test works well. if add together loop click 1 time again element, selenium not find because id has changed.

ex: id changing each time click on it.

<input type="text" id="a110_name" name="name" maxlength="255"> <input type="text" id="a120_name" name="name" maxlength="255">

my code:

driver.findelement(by.id("a110_name")).sendkeys("test");

how can resolve problem? give thanks you

good hear have solved using xpath. can solve using css locator below:

driver.findelement(by.cssselector("input[id$='_name']"));

we have utilize xpath's "contains" keyword caution, in cases might match other element. if more comfortable xpath, improve utilize //input[ends-with(@id,'_name')]

webdriver

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -