How To Add Selenium Server Standalone Jar File Into Your Java Project.You can read the article How To Find Web Element Using Web Browser Inspector to learn how to get the google search box and search button object name.Quit and close the Firefox web browser. Sleep 10 seconds to wait for the page load complete WebElement searchBtn = ffDriver.findElement(By.name("btnK"))
Get the google search button by the search button name. Press the keyboard Enter key to close the search tips drop-down list and search. Input search keyword text in the google search box. WebElement searchBox = ffDriver.findElement(By.name("q")) Get the google search box object by the search box name. Sleep 2 seconds to wait for the page load complete Set the geckodriver.exe path to the system property 's value.
Right-click the source code in the eclipse editor, click Run As -> Java Application menu item to run it.
Now you can use the FirefoxDriver object to browse web page by URL.WebDriver ffDriver = new FirefoxDriver() Create Firefox webdriver instance and launch Firefox browser. Set the above geckodriver.exe file path to the system property value to the os system environment variable PATH value before starting the Firefox web browser.
You can read the articles listed in the references section of this article to learn more.