How to Perform Active Element Example Java Selenium With Example?

How to Perform Active Element Example Java Selenium With Example?

package com.selenium.mix;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ActiveElement {
   public static void main(String[] args) throws InterruptedException 
   {
      // TODO Auto-generated method stub
      WebDriver obj=new FirefoxDriver();
      obj.get("http://www.google.com");
      obj.switchTo().activeElement().sendKeys("softwaretestingblog");
      obj.findElement(By.name("btnK")).click();
      Thread.sleep(3000);
      obj.close();
   }
}

Avatar for Softwaretestingo Editorial Board

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

Leave a Comment