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
Post a Comment