package jkcs; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; public class jdcs { public static void main (String [] args) throws InterruptedException { System.setProperty ( "webdriver.chrome.bin", "C: \\ Program Files (x86) \\ Mozilla Firefox \\ firefox.exe"); // Set the installation path To prevent the system from finding WebDriver driver = new FirefoxDriver (); //Initialize the FireFox browser instance and open the browser driver.manage (). Window (). Maximize (); // Maximize the window driver.navigate (). To ( "http://www.baidu.com" ); Thread.sleep ( 5000 ); driver.findElement (By.id ( "kw")). SendKeys ("china"); // Enter Thread.sleep ( 5000 ) in the text box ; Actions sj = new Actions (driver); sj.click (driver.findElement (By.id ( "su"))). perform (); // Simulate left mouse click Thread.sleep (8000 ); driver.quit (); } }