Wednesday, October 29, 2014

Chapter 20 - Most used Commands

Most used Commands

The below table lists the most used commands in Webdriver along with its syntax which will help us to develop Webdriver scripts seamlessly.
CommmandDescription
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()This will 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")Moving 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.

No comments: