Tuesday, 16 May 2017

Introduction to Selenium Web Driver.

Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.
Selenium Web Driver was developed in such a way that, it can support Multiple Browsers, the code can be written in Multiple Languages & can be executed in Multiple Platforms.
            Selenium Webdriver Architecture:
            Selenium web driver works on 3 components as mentioned below:
Figure 4: Selenium Webdriver Architecture
1.      Languages:
To write any script/framework, user can select any one language (as per his/her comfortable) & can write the code. The language will use common methods from Selenium Webdriver API to interact with the browser & perform any actions in the browser.

2.      WebDriver APIs:
Here, user can get all the pre-defined methods/classes which will communicate to the browser. After selecting the language will use Webdriver APIs to send request to the browser & will get the response from the browser.

3.      Browser Drivers:
We have various internet browser specific drivers such as ChromeDriver, IEDriver, FirefoxDriver, etc. which will be used to instantiate the specific browser. Once we create the object for any browser driver, by using that object we can operate the application.

How Selenium Web Driver works?
By considering the above architecture, let’s assume user have selected the language as JAVA. From the language user will use commands which are available in web driver API to interact with specific browser. On the other hand, the driver will do the operation as per the commands received from the webdriver API & will return the response to the code through Webdriver API.
Please check the below code to understand the flow:
WebDriver driver = new FirefoxDriver();
driver.get(“http://www.google.com”);

System.out.println(driver.getTitle());

Code Overview:
  • For writing the code I have selected the language as JAVA.
  • In 1st line by using Webdriver API, I have created the object of FirefoxDriver. Here, driver will open the firefox browser.
  • In 2nd line, using the API’s get() method I am passing the url. Here, it will open  http://www.google.com in firefox driver.
  • In 3rd line, the API will return the title to the code & we are printing the same in our code.
      

Next > Downloading WebDriver jars & configuring in eclipse.




5 comments:

  1. Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
    Selenium Training Institute in Chennai |

    Selenium Training in Velachery

    ReplyDelete
  2. Really very informative and creative contents. This concept is a good way to enhance the knowledge of Autocad.thanks for sharing please keep it up
    Software Testing Training in Gurgaon

    ReplyDelete
  3. i would like to share best automation testing services near you
    visit-https://www.dynamisers.com/automation-testing/

    ReplyDelete
  4. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. sayapro bin checker

    ReplyDelete
  5. International Nursing Recruitment Agencies in the USA specialize in bridging the gap between American healthcare facilities and qualified international nurses. These agencies meticulously guide candidates through the licensure and immigration processes, ensuring compliance with US regulations. They excel in credential assessments, visa processing, and placement services, facilitating a smooth transition into the US healthcare system. By offering cultural adaptation resources, they help nurses acclimate to their new professional environments. Emphasizing ethical recruitment, these agencies ensure high-quality candidate placements that meet the safety standards of US healthcare institutions. Their role is pivotal in addressing the nursing shortage by expanding the pool of skilled professionals. Through their expertise, they enhance patient care quality and contribute to a more diverse, culturally competent workforce.
    https://www.dynamichealthstaff.com/international-nursing-recruitment-agencies-in-usa

    ReplyDelete