0% found this document useful (0 votes)
76 views2 pages

Top Selenium Commands Cheat Sheet

Uploaded by

godse.1001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views2 pages

Top Selenium Commands Cheat Sheet

Uploaded by

godse.1001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

 Fetching a web page

o Using Get method

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

o Using Navigate method

driver.navigate().to("https://google.com ");

 Locating forms and sending user inputs


driver.findElement(By.id("lst-ib")).sendKeys("selenium tutorials");

 Clearing User inputs


driver.findElement(By.name("q")).clear();

 Fetching data over any web element


driver.findElement(By.id("element567")).getText();

 Performing Click event


driver.findElement(By.id("btnK")).click();

 Navigating backward in browser history


driver.navigate().back();

 Navigating forward in browser history


driver.navigate().forward();
 Refresh/ Reload a web page
driver.navigate().refresh();

 Closing Browser
driver.close();

 Closing Browser and other all other windows associated with


the driver
driver.quit();

 Moving between Windows


driver.switchTo().window("windowName");

 Moving between Frames


driver.switchTo().frame("frameName");

 Drag and Drop


WebElement element = driver.findElement(By.name("source"));
WebElement target = driver.findElement(By.name("target"));

(new Actions(driver)).dragAndDrop(element, target).perform();

You might also like