Home  >  Blog  >   Selenium  > 

How to Setup Selenium Grid Using WebDriver

Rating: 4
  
 
3495
  1. Share:
Selenium Articles

Selenium WebDriver Commands

We will look in detail for each of the SELENIUM WEBDRIVER commands that we have.

Browser initiation:

WEBDRIVER driver=new FirefoxDriver();
WebDriver driver=new SafariDriver();
WebDriver driver=new chromeDriver();
WebDriver driver=new InternetExplorerDriver();

Related Page: How To Use WebDriver Backed Selenium

  • Open URL:

driver.get(“https://www.google.com”);

Explore Selenium Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!
  • Click a link,Check box,Radio button, button:

driver.findElement(By.id(“gbqfq”)).click();

  • Clear the text field:

driver.findElement(By.id(“abc”)).clear();

  • Type in Text box or Text Area:

Check Out Selenium Tutorials

driver.findElement(By.name (“username”)).sendKeys(“test”);
Select a Value from Dropdown:
Select select = new Select(driver.findElement(By.tagName(“select”)));
select.selectByVisibleText(“Apple”);
Switch to window:
driver.switchTo().window(“windowName”);
Switch to Frame:
driver.switchTo().frame(“frameName”);
Switch to Alert:
driver.switchTo().alert().accept();
Confirmation Box:
driver.switchTo().alert().accept();
driver.switchTo().alert().dismiss();
Navigate Forward:
driver.navigate().forward();
Navigate Backward:
driver.navigate().back();

To gain in-depth knowledge and be on par with practical experience, then explore Selenium Training.

MindMajix YouTube Channel

Using Actions Class

Drag and Drop
WebElement source = driverdriver.findElement(By.name(“source”));
WebElement target = driver.findElement(By.name(“target”));
(new Actions(driver)).dragAndDrop(source, target).perform();
Mouse Hover:
Actions builder = new Actions(driver);
WebElementtagElement = driver.findElement(By.id(“someid”));
builder.moveToElement(tagElement).build().perform();

                                                Checkout Selenium Interview Questions

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Selenium Training May 23 to Jun 07
Selenium Training May 28 to Jun 12
Selenium Training May 30 to Jun 14
Selenium Training Jun 04 to Jun 19
Last updated: 07 Apr 2022
About Author
Madhuri Yerukala

Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

Recommended Courses

1 /15