Automation testing

·

3 min read

  1. Difference between Selenium web driver, Selenium IDE and Selenium Grid:
FunctionalitiesSelenium IDESelenium RCSelenium Webdriver
Record and playbackIt has the record and playback feature.It does not have a record and playback.It does not have a record and playback.
ServerIt requires no server to start execution of test cases.It requires the server to start execution of test cases.It requires no server to start execution of test cases.
BrowserIt can be used for testing only in Firefox.It can be used for testing in the majority of browsers.It can be used for testing in the majority of browsers including in headless mode.
Object OrientedIt is based on Selenese which is a procedural language.It can be partially used for object oriented programming.It is majorly used for object oriented programming.
Dynamic LocatorsElements cannot be identified.Elements cannot be identified.Elements can be identified.
AlertsCannot handle alerts.Cannot handle alerts.Can handle alerts
Mouse ActionsCannot handle mouse actions.Cannot handle mouse actions.Can handle mouse actions.
DropdownCannot handle dropdown.Cannot handle dropdown.Can handle dropdown.
iPhone/AndroidCannot perform iPhone/Android testing.Cannot perform iPhone/Android testing.Can perform iPhone/Android testing with the help of Android Driver, iPhone Driver.
ListenerDoes not have a Listener.Does not have a Listener.Have Listeners.
PerformanceFast [comes as a Firefox plugin]. It interacts with the browser directly.It does not interact with the browser directly. Hence on a slower side compared to webdriver.Fast as it interacts directly with the browser.
ArchitectureDerived from Javascript.Derived from Javascript.Not derived from Javascript.
UsageUI interface available to create scripts.Standalone Jars available to execute test cases in the browser.Contains API and supported by languages like Java, Python, and Ruby and so on.
XpathOnly has absolute xpath.Only has absolute xpath.Has both absolute and relative xpath.
NavigationCannot handle navigation.Cannot handle navigation.Can handle navigation.
  1. Selenium java script to open google and search "Selenium browser driver":

public static void main(String[] args) throws IOException {

//open firefox browser

WebDriver Driver = new ChromeDriver();

//opens the below url

Driver.get("https://www.google.com");

//maximize the window

Driver.manage().window().maximize();

//Take screenshot screenshot(Driver);

Driver.findElement(By.className("gLFyf")).sendKeys("Selenium browser driver"); WebElement ele = Driver.findElement(By.xpath("//span[text()='selenium browser drivers']/parent::div"));

Select objSelect =new Select(ele);

objSelect.selectByIndex(0);

}}

3.Selenium and it uses:

Selenium is an open-source suite of tools and libraries that is used for browser automation. Selenium us used to: It allows users to test their websites functionally on different browsers. Perform Cross browser testing to check if the website functions consistently across different browsers.

Selenium supports Functional Testing. As per Selenium's official website, “it supports Functional Testing at the System Testing Level and the Acceptance Testing Level of the Software Development Life Cycle”. Selenium automates the functional tests at the UI layer of the Web application under test.

  1. Browser driver used in selenium:

    AndroidDriver

    ChromeDriver

    FirefoxDriver

    InternetExplorerDriver

    IPhoneDriver

    SafariDriver

  2. Steps to create simple web driver script:

    //open firefox browser

    WebDriver Driver = new ChromeDriver();

    //opens the below url

    Driver.get("https://www.google.com");

    //maximize the window

    Driver.manage().window().maximize();