Posts

Showing posts from August, 2023

Type Script

 is a additiondal feature for java script typescrip= additional +typescript /* ES5- our current browser cannot understand es6 typescript also cannot understand. **-typescript convert script to javascript,es5-browser and protractor will understand-. **-scan the existing intenstiosn , symantics 1- npm install -g typescript 2-create a class bascis.ts 3-tsc basics.ts 4-it will create the js file -basics.js 5-run node basics.js */ basics.ts for ( var i = 0 ; i < 5 ; i ++ ){ setTimeout ( function (){ console . log ( i );}, 100 * i ); } basics.js for ( var i = 0 ; i < 5 ; i ++ ) { setTimeout ( function () { console . log ( i ); }, 100 * i ); } Export -- export class classDemo { // variable is called in class as property //Class consists of properties,methods,constructor //This - refere to current class property username : string ; password : string ; ssn : number ; //default constructor constructor ( ssn : number ){ this . ssn = ssn ...
 Selenium Grid
 Cucumber Notes What is Cucumber in selenium? Cucumber Framework in Selenium is an open-source testing framework that supports Behavior Driven Development for automation testing of web applications. The tests are first written in a simple scenario form that describes the expected behavior of the system from the user’s perspective. What is a feature file? A standalone unit or a single functionality (such as a login) for a project can be called a Feature. Each of these features will have scenarios that must be tested using Selenium integrated with Cucumber. A file that stores data about features, their descriptions, and the scenarios to be tested is called a Feature File Keywords such as GIVEN, WHEN, and THEN used to write the test in Cucumber are called Annotations. GIVEN user navigates to the login page by opening Firefox WHEN user enters correct <username> AND <password> values THEN user is directed to the homepage What is step Definition? A Steps Definitions file stor...

Synczation-js

  const { protractor , element } = require ( "protractor" ); describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://demos.telerik.com/aspnet-ajax/ajaxmanager/functionality/validation/defaultcs.aspx?product=ajaxpanel' ); element ( by . id ( 'ctl00_ContentPlaceholder1_tbName' )). sendKeys ( 'sudheer' ); element ( by . id ( 'ctl00_ContentPlaceholder1_tbEmail' )). sendKeys ( 'sudheer@qa.com' ); element ( by . name ( 'ctl00$ContentPlaceholder1$RegisterButton' )). click (); //Synczation-js var EC = protractor . ExpectedConditions ; // Waits for the element with id 'abc' to be visible on the dom. browser . wait ( EC . visibilityOf ( element ( by . id ( 'ctl00_ContentPlaceholder1_Label3' ))), 5000 ); browser . element ( by . id ( 'ctl00_ContentPlaceholder1_...

Frames-JS

describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://rahulshettyacademy.com/AutomationPractice/' ); browser . driver . manage (). window (). maximize (); browser . switchTo (). frame ( 'iframe-name' ); element ( by . css ( "a[href*='sign_in']" )). getText (). then ( function ( text ){ console . log ( text ); }) }); });

Alerts- Accept() Dismiss()

  const { func } = require ( "assert-plus" ); const { element } = require ( "protractor" ); describe ( '' , function (){ it ( 'Non angulat website Alets' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://rahulshettyacademy.com/AutomationPractice/' ); element ( by . id ( 'confirmbtn' )). click (). then ( function (){ browser . sleep ( '5000' ); }); // browser.switchTo().alert().accept() browser . switchTo (). alert (). dismiss (). then ( function (){ browser . sleep ( '5000' ); }) }) })

JS-Window handling-SwitchTabs

 - when you click on link it will open a new tab , to handle that suitation we use browser . switchTo().window(nameOrHandle). browser.open(//); element.getAllWindowHandlers().then(function(handlers){ // handlers- get the list of window browser.switchto().window( handlers[1] );//child window switchback to parent window browser.switchto().window( handlers[0] );//Parent window ) const { element , browser } = require ( "protractor" ); describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://rahulshettyacademy.com/AutomationPractice/' ); expect ( browser . getTitle ()). toBe ( 'Practice Page' ); browser . getTitle (). then ( function ( text ){ console . log ( text ); }); element ( by . id ( 'opentab' )). click (). then ( function (){ browser . sleep ( '3000' ); }) browser . getA...

Element.All()

 E-commerce - to get the count of all products we use count ()-method. Number of element eg: element.all(by.cs("tag[att='value']")).count(); Get by index: element.all(by.cs("tag[att='value']")).get(0).click(); //first and last: element.all(locator).first(); element.all(locator).last(); Add assertions to this expect(element.all(by.cs("tag[att='value']")).count()).toEqual(7));
 FrameWork Design Steps: file:///C:/Users/abc/Downloads/OpenCart_Selenium_Java_Framework+with+POM_Hybrid%20(2).pdf

JS Assertions

  describe ( '' , function (){ it ( '' , function (){ console . log ( 'Hello how are you' ); browser . get ( 'http://juliemr.github.io/protractor-demo/' ); element ( by . model ( 'first' )). sendKeys ( '12' ). then ( function (){ browser . sleep ( '3000' ); }); element ( by . css ( "input[ng-model='second']" )). sendKeys ( '14' ). then ( function (){ browser . sleep ( '4000' ); }); element ( by . id ( 'gobutton' )). click (). then ( function (){ browser . sleep ( '6000' ); }) //get text from page element ( by . css ( "h2[class='ng-binding']" )). getText (). then ( function ( text ){ console . log ( text ); console . log ( typeof ( text )); }) //assertions expect ( element ( by . css ( "h2[class...

JS MouseOver

  describe ( '' , function (){ it ( '' , function (){ browser . ignoreSynchronization = true ; browser . get ( "https://www.wikipedia.org/" ); //predicive search-selection browser . actions (). mouseMove ( element ( by . name ( 'search' )). sendKeys ( 'INDIA' )). perform (); browser . actions (). sendKeys ( protractor . Key . ARROW_DOWN ). perform (); browser . actions (). sendKeys ( protractor . Key . ENTER ). perform (); browser . element ( by . id ( 'firstHeading' )). getText (). then ( function ( text ){ console . log ( text ); expect ( text ). toBe ( 'India' ); }) }); }); const { browser , element , protractor } = require ( "protractor" ) describe ( '' , function (){ it ( '' , function (){ browser . waitForAngularEnabled ( false ); browser . get ( 'https://www.wikipedia.org/...

JS- Dropdown and Web Table data retrieve

Image
Webtable: Using all,repeater,each function getwebtableResults (){ element . all ( by . repeater ( "result in memory" )). each ( function ( item ){ //chain locators item . element ( by . css ( "td:nth-child(3)" )). getText (). then ( function ( text ){ console . log ( text ); }); }) } Get values of the dropdown and select the value .   element . all ( by . tagName ( "option" )). each ( function ( item ){ item . getAttribute ( 'value' ). then ( function ( values ){ console . log ( values ); }) describe ( '' , function (){ function calculate ( a , b , c ){ element ( by . model ( "first" )). sendKeys ( a ); element ( by . model ( "second" )). sendKeys ( b ); element . all ( by . tagName ( "option" )). each ( function ( item ){ item . getAttribute ( 'value...