SEMrush

Frequently used Selenium Commands

These are a few Selenium Commands , which are frequently used while writing the code in Eclipse

  • driver.get("URL") To navigate to an application.

  • element.sendKeys("inputtext") Enter some text into an input box.

  • element.clear() Clear the contents from the input box.

  • select.deselectAll() Deselect all OPTIONs from the first SELECT on the page.

  • select.selectByVisibleText("some text") Select the OPTION with the input specified by the user.

  • driver.switchTo().window("windowName") Move the focus from one window to another

  • driver.switchTo().frame("frameName") Swing from frame to frame.

  • driver.switchTo().alert() Helps in handling alerts.

  • driver.navigate().to("URL") Navigate to the URL.

  • driver.navigate().forward() To navigate forward.

  • driver.navigate().back() To navigate back.

  • driver.close() Closes the current browser associated with the driver.

  • driver.quit() Quits the driver and closes all the associated window of that driver.

  • driver.refresh() Refreshes the current page.
Previous                                                                        Next

Links to useful posts: