Home » Java » javascript – Unable to locate element for the drop down input field in my application-Exceptionshub

javascript – Unable to locate element for the drop down input field in my application-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

Unable to locate element for the drop-down input field and I am trying to locate the element using id (caction-3) and class name and its is displayed inside the tag in the row.

So, kindly give me the solution.

Selenium script:

List < WebElement > findtags = d.findElements(By.className("rejected_row"));
System.out.println("Find tags list " + findtags);

for (WebElement searchtags: findtags) {
  String taglist = searchtags.getText().toString();
  //System.out.println("TAG DATA");
  System.out.println(taglist);
  //int i = 0;
  if (taglist.equals("Inactive")) {
    ele.setElement("caction-3");
    ele.AccessWebElementById(d).sendKeys(action);
    ele.AccessWebElementById(d).click();
  } else {
    System.out.println("No such Inactive task");
  }
}

Thanks,
Vairamuthu

How to&Answers:

Probably, more information is required before helping you out. Element location screenshot, error from selenium etc…because you may be locating element incorrectly or some wait may require until element is loaded. A general example is below.

Select test = new Select(driver.findElement(By.id("testing")));
drpCountry.selectByVisibleText("dropdown");
selectByValue("value")
selectByIndex(anyIndex)