import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class Test1 {

    public static void main(String[] args) throws InterruptedException {
          // TODO Auto-generated method stub
          WebDriver driver= new ChromeDriver();
          List<WebElement> elements = driver.findElements(By.xpath("//input[@type= 'checkbox']"));

          for(WebElement el:elements)
  • Can you try by providing wait statement.
    – shanila
    Jan 19 '19 at 12:11
  • I have used wait but still the program is going timeout exception. Jan 20 '19 at 4:26
  • Code looks good, providing wait as suggested by Shanila should help, if not please share the exception stack.
    – Shamanth
    Jan 21 '19 at 3:45
  • There could be a potential issue in the click statement as you are performing them in a loop. After performing the initial events, the state of the rest of the elements might be changing. So please be careful while performing webdriver events in loop. Jan 21 '19 at 5:32
  • Probably your browser was updated and you need to update your webdriver?
    – Alexey R.
    Jan 21 '19 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.