0

Java & Selenium Code:

List<WebElement> ele_list_search = driver .findElements(By.xpath("//div[@class='home-content__search-item-section ']")); ele_list_search.get(0).click();

Question: How to perform above using Karate for UI automation where collect elements into list and click on the particular element based on the index in the list?

  • 1
    this should help, else I pass on this question: https://stackoverflow.com/a/63623132/143475 – Peter Thomas Feb 23 '22 at 10:17
  • I give up, sorry. the link has PLENTY of examples. you may need to do some research – Peter Thomas Feb 23 '22 at 10:49
  • @PeterThomas - I have not used 'scriptAll()' as I don't want to get the test and compare. So, I have used 'locateAll' and below code but still not working through Karate script: '* def properties = locateAll("//div[@class='home-content__search-item-section ']") * print 'properties size = ', properties.length * properties[0].click()' – Jeetendra Edke Feb 23 '22 at 11:32
  • I have nothing to add to my previous comment – Peter Thomas Feb 23 '22 at 11:47

0 Answers0