I have more than one element on page which has same xpath and same id/name , there are two fields on page with same locators i tried to enter value at desired location with below code
element.all(by.xpath('//*[@id="testInstanceScan"]')).get(1).sendKeys('Vkumar');
but I faced error message:
Failed: Index out of bound. Trying to access element at index: 1, but there are only 1 elements that match locator By(xpath, //*[@id="testInstanceScan"] )
if i used element.all('#testInstanceScan').get(1).sendKeys('Vkumar');
i faced error
Failed: Invalid locator Stack: TypeError: Invalid locator
Tried with element.all(by.css('#testInstanceScan')).get(0).sendKeys('Vkumar');
but its not the desired place for this value,.
values is entered in previous fields with this 0th intdex.