Friday, July 17, 2020

Getting Started With Selenium Web-driver

1.Browsers


  • The Selenium framework officially supports the following browsers:


2. Third party drivers and plug-ins

  • Selenium can be extended through the use of plugins. Here are a number of plugins created and maintained by third parties.



3. Locating Elements

  • There are eight different built-in element location strategies in WebDriver:



Locating an element


  • One of the most fundamental techniques to learn when using WebDriver is how to find elements on the page. WebDriver offers a number of built-in selector types, amongst them finding an element by its ID attribute:

For Example:

  1. WebElement cheese = driver.findElement(By.id("cheese"));

  2. driver.findElement(By.cssSelector("#cheese #cheddar"));


4. Performing actions on the AUT



Some basic actions that can be performed by Selenium Web-driver:   

 1) You can set an element’s text using the sendKeys method as follows:

     String name = "Charles";
     driver.findElement(By.name("name")).sendKeys(name);

2) Some web applications use JavaScript libraries to add drag-and-drop functionality.

     WebElement source = driver.findElement(By.id("source"));
     WebElement target = driver.findElement(By.id("target"));
     new Actions(driver).dragAndDrop(source, target).build().perform();

3) You can click on an element using the click method:

     driver.findElement(By.cssSelector("input[type='submit']")).click();
 

 

 References

  • Official website of Selenium https://www.selenium.dev/
  • https://learnbasicsofsoftwaretesting.blogspot.com/
  • https://en.wikipedia.org/wiki/Selenium_(software)

Share:

0 comments:

Post a Comment

Email Subscription

Enter your email address:

Delivered by FeedBurner

Follow my blog

Total Pageviews

Contact Form

Name

Email *

Message *

Translate