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) lanza InterruptedException { System.setProperty ( "webdriver.chrome.bin", "C: \\ Program Files (x86) \\ Mozilla Firefox \\ firefox.exe"); // Establezca la ruta de instalación Para evitar que el sistema encuentre el controlador WebDriver = nuevo FirefoxDriver (); //Inicialice la instancia del navegador FireFox y abra el navegador driver.manage (). Window (). Maximize (); // Maximize window driver.navigate (). To ( "http://www.baidu.com" ); Thread.sleep ( 5000 ); driver.findElement (By.id ( "kw")). SendKeys ("china"); // Ingrese Thread.sleep ( 5000 ) en el cuadro de texto ; Actions sj = new Actions (driver); sj.click (driver.findElement (By.id ( "su"))). perform (); // Simular el clic izquierdo del mouse Thread.sleep (8000 ); driver.quit (); } }