Top Selenium Commands

manual testing

Top Selenium Commands

Below is the list of most frequently asked selenium interview questions and top selenium commands. The list contains Selenium Advanced Questions which will be very helpful for your next interview.

1- Fetching a web page

Using Get method

driver.get("www.google.com")

Using Navigate method

driver.navigate().to("https://google.com ");
2- Locating forms and sending user inputs
 driver.findElement(By.id("lst-ib")).sendKeys("selenium tutorials");
3- Clearing User inputs
 driver.findElement(By.name("q")).clear();
4- Fetching data over any web element
 driver.findElement(By.id("element567")).getText();
5- Performing Click event
 driver.findElement(By.id("btnK")).click();
6- Navigating backward in browser history
 driver.navigate().back();
7- Navigating forward in browser history
 driver.navigate().forward();
8- Refresh/ Reload a web page
 driver.navigate().refresh();
9- Closing Browser
 driver.close();
10- Closing Browser and other all other windows associated with the driver

 

driver.quit();
11- Moving between Windows
 driver.switchTo().window("windowName");
12- Moving between Frames
 driver.switchTo().frame("frameName");
13- Drag and Drop
WebElement element = driver.findElement(By.name("source")); 
WebElement target = driver.findElement(By.name("target"));
(new Actions(driver)).dragAndDrop(element, target).perform();