Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

Test if an element is focused using Selenium Webdriver.

Category: Selenium WebDriver
// identify element
      WebElement l=driver.findElement(By.cssSelector(".gsc-input"));
      //activeElement() to verify element focused
      if(l.equals(driver.switchTo().activeElement()))
         System.out.println("Element is focused");
      else
         System.out.println("Element is not focused");

Leave a Reply

Your email address will not be published. Required fields are marked *