How to use driver.pressKeycode method in Appium

Best JavaScript code snippet using appium

obvPage.js

Source:obvPage.js Github

copy

Full Screen

1const base = require('../../BaseClass/base')2class obv {3 get mainPopup(){return base.getByResourceId("in.droom:id/btn_close")}4 get hamburgerMenu(){return base.getByContDesc("Navigate up") }5 get services() {return base.getByText("All services")}6 get Certification_Services() { return base.getByText("Certification Services") }7 get obv() { return base.getByResourceIdNText ("in.droom:id/txt_quicklink","OBV")}8 get proceedbtn() {return base.getByText("Proceed")}9 get obvTitle(){return base.getByText("Orange Book Value")}10 get pricingCalculator(){return base.getByText("Vehicle Pricing Calculator")}11 get used(){return base.getByText("Used")}12 get newTab(){return base.getByText("New")}13 get exchange(){return base.getByText("Exchange")}14 get futurePrice(){return base.getByText("Future Price")}15 get residual(){return base.getByText("Residual")}16 get subtitle(){return base.getByText("Used Vehicle Pricing Calculator shows the pricing of Used Automobiles")}17 get IwanttoBuy(){return base.getByText("I want to Buy")}18 get IwanttoSell(){return base.getByText("I want to Sell")}19 get selectMake(){return base.getByResourceIdNText("make","Select Make")}20 get selectModel(){return base.getByResourceIdNText("model","Select Model")}21 get selectYear(){return base.getByResourceIdNText("year","Select Year")}22 get selectTrim(){return base.getByResourceIdNText("trim","Select Trim")}23 get kmsDriven(){return base.getByResourceId("kms_driven")}24 get checkPrice(){return base.getByText("Check Price")}25 get fromIndividual(){return base.getByText("From Individual")}26 get fromDealer(){return base.getByText("From Dealer")}27 get toIndividual(){return base.getByText("To Individual")}28 get toDealer(){return base.getByText("To Dealer")}29 get obvLogo(){return base.getByText("OBV Logo")}30 get car(){return base.getByResourceIdNText("android:id/text1","Car")}31 get audi(){return base.getByResourceIdNText("android:id/text1","Audi")}32 get yr2020(){return base.getByResourceIdNText("android:id/text1","2020")}33 get TdiPPlus(){return base.getByResourceIdNText("android:id/text1","35 TDI PREMIUM PLUS")}34 get checkObvBtn(){return base.getByResourceIdNText("mmt_submit","Check OBV")}35 get rs(){return base.getByText("₹27,38,353 - ₹29,07,736 *")}36 get obvPopup(){return base.getByText("This image isn‘t labelled. Open the 'More options' menu at the top right to get image descriptions.")}37 get good(){return base.getByText("Good")}38 // get smallpopUp(){return base.getByText("x")}39 get smallpopUp() {return base.getByText("Hi, I am Your Personal Droom Assistant Let's chat")}40 get valueAt(){return base.getByText("Automobile From Individual In Good Condition Is Valued At")}41 get usedcar2(){return base.getByText("/ Used car")}42 get futurePriceInfo(){return base.getByText("Know the Estimated Re-Selling Price for your vehicle in coming years.")}43 get forNew(){return base.getByText("For New")}44 get forUsed(){return base.getByText("For Used")}45 get futureCategory(){return base.getByResourceId("futurenewcategory")}46 get futureMake(){return base.getByResourceId("futurenewmake")}47 get futureModel(){return base.getByResourceId("futurenewmodel")}48 get futureTrim(){return base.getByResourceId("futurenewtrim")}49 get futureResale(){return base.getByResourceId("futurenewexpectedresale")}50 get futureKms(){return base.getByResourceId("futurenewexpected_kms_driven")}51 get futureEstimate(){return base.getByText("Check Future Estimate")}52 get futureModeName(){return base.getByText("A4")}53 get futureTrimName(){return base.getByText("40 TFSI PREMIUM PLUS")}54 get yeOfResale(){return base.getByText("2022")}55 get result(){return base.getByText("/ Result")}56 get obvValueBy(){return base.getByText("OBV Value By")}57 get futurePriceResult(){return base.getByText("Future Price of Audi A4 40 TFSI PREMIUM PLUS evolution in 2022 after 200 Kms")}58 get exchangeInfo(){return base.getByText("Select the Vehicle you want to Exchange Your Current Vehicle With and Know The Price Difference.")}59 get IwanttoExchange(){return base.getByText("I want to Exchange:")}60 get exchangeCategory(){return base.getByResourceId("exchangecategory")}61 get exchangeMake(){return base.getByResourceId("exchangemake")}62 get exchangeModel(){return base.getByResourceId("exchangemodel")}63 get exchangeYear(){return base.getByResourceId("exchangeyear")}64 get exchangeTrim(){return base.getByResourceId("exchangetrim")}65 get exchangeKms(){return base.getByResourceId("exchangekms_driven")}66 get exchangeWith(){return base.getByText("With:")}67 get withNew(){return base.getByText("New")}68 get withOld(){return base.getByText("Used")}69 get exchangeNewMake(){return base.getByResourceId("exchangenewmake")}70 get exchangeNewModel(){return base.getByResourceId("exchangenewmodel")}71 get exchangeNewTrim(){return base.getByResourceId("exchangenewtrim")}72 get bmwCar(){return base.getByText("BMW")}73 get bmwModel(){return base.getByText("2 Series Gran Coupe")}74 get bmwTrim(){return base.getByText("220D M SPORT")}75 get chkExchangePrice(){return base.getByText("Check Exchange Price")}76 get resultExchange(){return base.getByText("Exchange with")}77 get newInfo(){return base.getByText("Check Price of New Vehicle and How it will depreciate in Upcoming Years")}78 get newCategory(){return base.getByResourceId("newcategory")}79 get newMake(){return base.getByResourceId("newmake")}80 get newModel(){return base.getByResourceId("newmodel")}81 get newTrim(){return base.getByResourceId("newtrim")}82 get newLocation(){return base.getByText("Location")}83 get a3(){return base.getByResourceIdNText("android:id/text1","A3")}84 get CheckPriceOnNew(){return base.getByText("Check Price")}85 get ModelNamenew(){return base.getByText("A4")}86 get newTrimName(){return base.getByText("40 TFSI PREMIUM PLUS")}87 get searchMyLocation(){return base.getByText("Search My Location")}88 get residualInfo(){return base.getByText("Residual Value of the vehicle provides an estimate of the worth of the vehicle at the end of the lease.")}89 get ForNew(){return base.getByText("For New")}90 get ForUsed(){return base.getByText("For Used")}91 get residualCategory(){return base.getByResourceId("leasenewcategory")}92 get residualMake(){return base.getByResourceId("leasenewmake")}93 get residualModel(){return base.getByResourceId("leasenewmodel")}94 get residualTrim(){return base.getByResourceId("leasenewtrim")}95 get residualTenure(){return base.getByResourceId("leasenewtenure")}96 get residaulKms(){return base.getByResourceId("leasenewkms_driven_month")}97 get cheResidualEstimate(){return base.getByText("Check Residual Estimate")}98 get residualModelName(){return base.getByText("A4")}99 get residualTrimName(){return base.getByText("40 TFSI PREMIUM PLUS")}100 get residualResult(){return base.getByText("Lease Per Month:")}101 get headingPricingCtr(){return base.getByText("Pricing Certificate")}102 get viewPricingCertificate(){return base.getByText("View Pricing Certificate")}103 get pdfmsg(){return base.getByText("Don't ask again")}104 get selectCategory(){return base.getByResourceIdNText("category","Select Category")}105 // get buy() { return base.getByText("Buy") }106 get menu() {return base.getByText("Menu")}107 get valuation() {return base.getByText("Valuation")}108 get selectfromdropdown() {return base.getByResourceId("in.droom:id/tv_enter_manually")}109 get selectbrand() {return base.getByText("Select Brand")}110 get brandvalue() {return base.getByText("Aston Martin")}111 get selectmodel() {return base.getByText("Select Model")}112 get modelvalue() {return base.getByText("DB9")}113 get selectyear() {return base.getByText("Select Year")}114 get yearvalue() {return base.getByText("2004")}115 get selecttrim() {return base.getByText("Select Trim")}116 get trimvalue() {return base.getByText("6L V12")}117 get kms() {return base.getByText("Enter KM Driven")}118 get submit(){return base.getByText("Submit >")}119 async traverseToObv() {120 await base.androidLoginAsBuyer()121 console.log("Traversing to Obv") 122 await browser.pause(2000)123 await (await this.menu).click()124 console.log("Clicked on Menu")125 await base.scrollToExactText("All services")126 await (await this.services).click()127 await (await this.Certification_Services).click()128 base.scrollToResourceID(this.obv)129 await (await this.obv).click()130 expect(await this.obvTitle).toBeDisplayed()131 console.log("Orange Book Value title shown")132 }133 134async inputToCheckPrice() {135console.log("Taking Inputes for Expected Vechile")136await(await this.selectCategory).click()137console.log("Clicked On select Category")138await(await this.car).click()139console.log("Clicked On Car Category")140await(await this.selectMake).click()141await(await this.audi).click()142console.log("Clicked On Make")143await(await this.selectModel).click()144await(await this.a3).click()145console.log("Selected the required Model")146await(await this.selectYear).click()147console.log("Clicked on the year")148await(await this.yr2020).click()149console.log("Clicked On expected Year")150await(await this.selectTrim).click()151console.log("Clicked on Trim")152await(await this.TdiPPlus).click()153console.log("Clicked On expected Trim")154await(await this.kmsDriven).click()155console.log("Clicked on KmsDriven")156await driver.hideKeyboard()157await driver.pressKeyCode(9, undefined, undefined);158await driver.pressKeyCode(7, undefined, undefined);159await driver.pressKeyCode(7, undefined, undefined);160console.log("Set the value for KMS driven")161}162async inputToNew() {163 console.log("Taking Inputs for New")164 await(await this.newCategory).click()165 console.log("Clicked on Select Category")166 await(await this.car).click()167 console.log("Clicked On Car Category")168 await(await this.newMake).click()169 console.log("Clicked on Make")170 await(await this.audi).click()171 console.log("Selected the Make")172 await(await this.newModel).click()173 await(await this.ModelNamenew).click()174 console.log("Selected the New Model Name")175 await(await this.newTrim).click()176 console.log("Clicked on New Trim")177 await(await this.newTrimName).click()178 await(await this.newLocation).click()179 console.log("Clicked on Location")180 expect(await this.searchMyLocation).toBeDisplayed()181 console.log("Search My Location is available")182 await(await this.searchMyLocation).click()183 console.log("CLicked on Search My Location")184 await(await this.searchMyLocation).setValue("Delhi")185 await(await this.CheckPriceOnNew).click()186}187async inputToExchange() {188 // await (await this.smallpopUp).waitForExist()189 //console.log("Help pop Up is Displayed")190 // await (await this.smallpopUp).click()191 console.log("Taking Inputs for Exchange")192 await(await this.exchangeCategory).click()193 console.log("Clicked on Select Category")194 await(await this.car).click()195 console.log("Clicked On Car Category")196 await(await this.exchangeMake).click()197 console.log("Clicked on Make")198 await(await this.audi).click()199 console.log("Clicked On Make")200 await(await this.exchangeModel).click()201 await(await this.a3).waitForExist({ timeout: 5000 })202 await(await this.a3).click()203 console.log("Selected the required Model")204 await(await this.exchangeYear).click()205 console.log("Clicked on the year")206 await(await this.yr2020).click()207 console.log("Clicked On expected Year")208 await(await this.exchangeTrim).click()209 console.log("Clicked on Trim")210 await(await this.TdiPPlus).click()211 console.log("Clicked On expected Trim")212 await(await this.exchangeKms).click()213 console.log("Clicked on KmsDriven")214 await driver.hideKeyboard()215 await driver.pressKeyCode(9, undefined, undefined);216 await driver.pressKeyCode(7, undefined, undefined);217 await driver.pressKeyCode(7, undefined, undefined);218 console.log("Set the value for KMS driven")219}220 async inputToFutureEstimate() {221 console.log("Taking Inputs for New Future Price")222 //await (await this.smallpopUp).waitForExist()223 //console.log("Help pop Up is Displayed")224 //await (await this.smallpopUp).click()225 await (await this.futureCategory).click()226 console.log("Clicked on Select category")227 await(await this.car).click()228 console.log("Clicked On Car Category")229 await(await this.futureMake).click()230 console.log("Clicked on Select Make")231 await(await this.audi).click()232 await (await this.futureModel).click()233 console.log("Clicked on Select Model")234 await(await this.futureModeName).waitForExist({ timeout: 5000 })235 await(await this.futureModeName).click()236 await (await this.futureTrim).click()237 console.log("Clicked on Select Trim")238 await(await this.futureTrimName).click()239 await (await this.futureResale).click()240 console.log("Clicked on Year Of Resale")241 await(await this.yeOfResale).click()242 console.log("Selected the Year of Resale")243 await (await this.futureKms).click()244 console.log("Clicked on Kms Driven")245 await driver.hideKeyboard()246 await driver.pressKeyCode(9, undefined, undefined)247 await driver.pressKeyCode(7, undefined, undefined)248 await driver.pressKeyCode(7, undefined, undefined)249 console.log("Set the value for KMS driven")250 await(await this.futureEstimate).click()251 console.log("Clicked on Check Future Estimate")252}253async inputToResidual() {254 console.log("Taking Inputs for Residual")255 //await (await this.smallpopUp).waitForExist()256 //console.log("Help pop Up is Displayed")257 // await (await this.smallpopUp).click()258 await (await this.residual).click()259 console.log("Clicked on Residual")260 await(await this.residualCategory).click()261 await(await this.car).click()262 console.log("Clicked On Car Category")263 await(await this.residualMake).click()264 await(await this.audi).click()265 console.log("Clicked On Make")266 await(await this.residualModel).click()267 await(await this.residualModelName).waitForExist({ timeout: 5000 })268 await(await this.residualModelName).click()269 await(await this.residualTrim).click()270 await(await this.residualTrimName).click()271 await(await this.residualTenure).click()272 await driver.hideKeyboard()273 await driver.pressKeyCode(9, undefined, undefined)274 await driver.pressKeyCode(9, undefined, undefined)275 console.log("Set the value for Tenure in month")276 await(await this.residaulKms).click()277 console.log("Clicked on Kms Driven")278 await driver.hideKeyboard()279 await driver.pressKeyCode(9, undefined, undefined)280 await driver.pressKeyCode(7, undefined, undefined)281 await driver.pressKeyCode(7, undefined, undefined)282 console.log("Set the value for KMS driven")283}284}285module.exports = new obv()...

Full Screen

Full Screen

Steps.js

Source:Steps.js Github

copy

Full Screen

1import { Then, Given, When} from "cucumber";2import Payments from "../../page-objects/Payments/Payments";3import axios from 'axios'4import { Gestures } from '../../../helpers/Gestures'5//'./helpers/Gestures.js'6var chai = require('chai');7var sinon = require('sinon-chai');8chai.use(require('sinon-chai'));9Given(/^Usuario realiza login (.*)$/, 10function (email) {11 console.log(" USUARIO REALIZA LOGIN");12 13var deviceId = Payments.getText("//*[contains(@content-desc, 'deviceId:')]");14var linkAccountTokenPath = Payments.getText("//*[contains(@content-desc, 'magicLinkBaseUrl:')]")15var actionToken16var appBundleId17var environment18var urlLinkAccount19console.log("getCurrentDevice id: "+deviceId);20appBundleId = driver.getCurrentPackage();21console.log("getCurrentPackage id: "+appBundleId);22// ar.com.bdsol.bds.squads.yellow23environment= appBundleId.slice(17,20)24console.log("getCurrent Environment: "+environment);25// urlLinkAccount= "https://bff-mobile-"+environment+".bdsdigital.com.ar/api/auth/link-account-token";26urlLinkAccount= "https://bff-mobile-int.bdsdigital.com.ar/api/auth/link-account-token";27console.log("getCurrent urlLinkAccount: "+urlLinkAccount);28 axios.post(urlLinkAccount, { // auth-int.bdsdigital29 deviceId,30 email,31 appBundleId //: "ar.com.bdsol.bds.integration"//"ar.com.bdsol.bds.uat"//32 }).then(resp => {33 actionToken =resp.data.actionToken;34 console.log("action token : "+actionToken);35 console.log("getCurrent resp.data: "+resp.data);36 browser.url(linkAccountTokenPath+"/link-account?token="+actionToken);// open-uat37 // driver.url("https://open-int.bdsdigital.com.ar/link-account?token="+actionToken);38 });39});40Given(/^usuario swipea (.*)$/, 41function (elemento) {42 var label='~';43 // var selector =label+element44 // driver.touchScroll(10, 100, element);45 // AppiumDriver.performTouch() with args: [[46 // {"action":"press","options":{"x":1034,"y":1188}},{"action":"wait","options":{"ms":500}},{"action":"moveTo","options":{"x":677,"y":1177}},{"action":"release","options":{}}],"13019aae-2e08-49f1-b4fe-4dfb12d2b4b3"]47 // driver.touchPerform([48 // { action: 'press', options: { x: 1034, y: 1188 }},49 // { action: 'moveTo', options: { x: 677, y: 1177 }},50 // { action: 'release' }51 // { action: 'press', options: [Object] },52 // { action: 'moveTo', options: [Object] },53 // { action: 'release' }54 // ]);55 // Payments.sistemaIndica(label.concat(fileName));56 Payments.sistemaIndica(elemento)57 58 // $(elemento).touchAction([59 // 'press',60 // { action: 'moveTo', x: 0, y: 632 },61 // 'release'62 // ])63 // browser.touchAction([64 // { action: 'press', x: 600, y: 600 },65 // { action: 'moveTo', x: 100, y: 600 },66 // 'release'67 // ])68 69 console.log('Localization x: '+$(elemento).getLocation('x'));70 let xpos = $(elemento).getLocation('x') +10071 console.log('Localization y: '+$(elemento).getLocation('y')); 72 let ypos = $(elemento).getLocation('y') +10073 driver.touchPerform([74 { action: 'press', options: { x: xpos, y: ypos }},75 {76 action: "wait",77 options: { ms: 1000 }78 },79 { action: 'moveTo', options: { x: xpos-100, y: ypos }},80 { action: 'release' }81 ]);82 driver.pause(1000);83});84// Given(/^Login con usuario (.*)$/, mail => {85// Payments.sistemaIndica('~¡Bienvenido!')86// deviceId = $('~deviceId').getText().trim();87// magicLinkBaseUrl = $('~magicLinkBaseUrl').getText().trim()88// const actionToken = browser.call(() => linkAccountToken(mail, deviceId));89// browser.url(`${magicLinkBaseUrl}/link-account?token=${actionToken}`);90// });91Given(/^Usuario selecciona (.*)$/, 92function (fileName) {93 var label='~';94 label.concat(fileName);95 Payments.usuarioSelecciona(label.concat(fileName));96});97Given(/^Usuario recibe notificacion beneficios (.*)$/, 98function (nroBenef) {99 var customerId="16"100 var campaignId="LOYALTY_PROGRAM_20"101 var completedStepId="TRANSFERS"102 var completedStepsCount=nroBenef103 var payload={campaignId,completedStepId,completedStepsCount}104 105 axios.post('https://notifications-yellow.bdsdigital.com.ar/campaigns/notify-completed-step', { 106 customerId,107 payload108 }).then();109});110Given(/^Sistema indica (.*)$/, 111function (fileName) {112 var label='~';113 label.concat(fileName);114 Payments.sistemaIndica(label.concat(fileName));115});116Given(/^Wait (.*) seconds$/, 117function (time) {118 Payments.waitTIme(time);119});120Given(/^usuario abre notificaciones$/, 121function () {122 driver.openNotifications();123 124});125 126When(/^usuario selecciona (.*)$/, 127function (fileName) {128 var label='~';129 label.concat(fileName); 130 // Agendar servicio131 if(fileName=='Agendar servicio')132 {133 if(browser.config.capabilities.browserName=='iOS')134 {135 Payments.usuarioPresiona('(//XCUIElementTypeOther[@name="Agendar servicio"])[2]/XCUIElementTypeOther'); 136 } else {137 Payments.usuarioPresiona('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup[4]/android.view.ViewGroup'); 138 }139 } else {140 Payments.usuarioSelecciona(label.concat(fileName)); 141 }142 143});144Given(/^usuario cierra notificaciones$/, 145 function () {146 driver.pressKeyCode(4);147 148 });149When(/^usuario copia el valor (.*)$/, 150function (valorCopiado) {151 var clipboard =driver.getClipboard().trim();;152console.log(clipboard)153 if(valorCopiado==clipboard)154 {155 } else {156 new Error('oh no' + driver.getClipboard())157 }158});159When(/^usuario presiona Xpath (.*)$/, 160function (fileName) {161 Payments.usuarioPresiona(fileName);162});163When(/^sistema muestra Xpath (.*)$/, 164function (fileName) {165 Payments.sistemaIndicaXpath(fileName);166});167When(/^sistema no muestra Xpath (.*)$/, 168function (fileName) {169 Payments.sistemaNOIndicaXpath(fileName);170});171When(/^sistema indica Xpath (.*)$/, 172function (fileName) {173 Payments.sistemaIndicaXpath(fileName);174});175When(/^sistema muestra xpath (.*) con texto (.*)$/, 176function (fileName,texto) {177 Payments.sistemaIndicaXpathConTexto(fileName, texto);178});179When(/^sistema indica (.*)$/, 180function (fileName) {181 var label='~';182 label.concat(fileName);183 Payments.sistemaIndica(label.concat(fileName));184});185When(/^sistema no muestra el valor (.*)$/, 186function (fileName) {187 var label='~';188 label.concat(fileName);189 Payments.sistema_no_muestra_el_valor(label.concat(fileName));190});191Then(/^Usuario selecciona (.*)$/, 192function (fileName) {193 var label='~';194 label.concat(fileName);195 Payments.usuarioSelecciona(label.concat(fileName));196});197Then(/^usuario verifica monto a pagar (.*) en el campo (.*)$/, 198function (factura, montoAPagar) {199 Payments.usuarioVerificaMonto(factura, );200});201Then(/^Sistema indica (.*)$/, 202function (fileName) {203 var label='~';204 label.concat(fileName);205 Payments.sistemaIndica(label.concat(fileName));206});207 208When(/^usuario completa el campo (.*) con el valor (.*)$/, 209function (fileName, valor) {210 var label='~';211 label.concat(fileName);212 Payments.usuario_completa_el_campo(label.concat(fileName), valor);213});214When(/^usuario completa campo xpath (.*) con el valor (.*)$/, 215function (fileName, valor) {216 Payments.usuario_completa_el_campo(fileName, valor);217});218When(/^usuario presiona borrar (.*) veces$/, 219function (cant) {220 if(browser.config.capabilities.browserName=='iOS')221 {222 console.log("ESTA EN IOS");223 var label='~';224 for (var i = 0; i < cant; i++) {225 Payments.usuario_completa_el_campo(label.concat('Ingresa el monto a pagar'), '\b');226 }227 228 } else {229 console.log("ESTA EN ANDROID");230 for (var i = 0; i < cant; i++) {231 driver.pressKeyCode(67);232 }233 }234 235});236When(/^usuario swipea elemento (.*) a la izquierda$/, 237function (element) {238 $("~"+element).touchAction({239 action: 'tap', x: 30, y:20240 })241 242});243Given(/^CloseSystemUIisntResponding$/, 244 function () {245 var fileName ="android:id/aerr_close"246 var label='~';247 try {248 Payments.usuarioSelecciona(label.concat(fileName));249 Payments.usuarioSelecciona(label.concat(fileName));250 Payments.usuarioSelecciona(label.concat(fileName));251 } catch (error) {252 console.log(error);253 }254 255 });256 257When(/^usuario presiona Boton Volver Atras$/, 258function () {259 driver.pressKeyCode(4); 260});261When(/^usuario ingresa el valor (.*) al campo (.*)$/, 262function (value, label) {263 // console.log(driver.sessionCapabilities());264 console.log(browser.config.capabilities.browserName);265 // iOS266 // Android267 if(browser.config.capabilities.browserName=='iOS')268 {269 console.log("ESTA EN IOS");270 var labelTag='~';271 Payments.usuario_completa_el_campo(labelTag.concat(label), value);272 } else {273 console.log("ESTA EN ANDROID");274 var labelTag='~';275 Payments.usuarioSelecciona(labelTag.concat(label));276 for (var i = 0; i < value.length; i++) { 277 switch (value.charAt(i)) {278 case '0':279 driver.pressKeyCode(7);280 break; 281 case '1':282 driver.pressKeyCode(8);283 break;284 case '2':285 driver.pressKeyCode(9);286 break;287 case '3':288 driver.pressKeyCode(10);289 break;290 case '4':291 driver.pressKeyCode(11);292 break;293 case '5':294 driver.pressKeyCode(12);295 break;296 case '6':297 driver.pressKeyCode(13);298 break;299 case '7':300 driver.pressKeyCode(14);301 break;302 case '8':303 driver.pressKeyCode(15);304 break;305 case '9':306 driver.pressKeyCode(16);307 break;308 default: 309 } }310 }311 312});313When(/^Reset wiremock$/, 314function () {315 316 if(browser.config.capabilities.browserName=='iOS')317 {318 console.log("ESTA EN IOS");319 axios.post("http://localhost:9999/__admin/mappings/reset").then(resp => {320 console.log(resp.data);321 });322 } else {323 console.log("ESTA EN ANDROID");324 axios.post("http://localhost:8080/__admin/mappings/reset ").then(resp => {325 console.log(resp.data);326 });327 }328 driver.reset();329});330When(/^sistema muestra elemento (.*) con texto (.*)$/, 331function (field, valor) {332 var label='~';333 Payments.sistema_muestra_elemento_con_texto(label.concat(field), valor);334 335});336When(/^usuario scrolea hacia (.*)$/, 337function (element) {338 // var label='~';339 driver.touchScroll(10, 100, element);340 341});342// @Given("^Get to wiremock (.*)$")343// public void reset_wiremock(String url){344// //__admin/reset345// given().when().get("http://localhost:8080"+url).then().statusCode(200);346// }347When(/^Get to wiremock (.*)$/, 348 function (url) {349 if(browser.config.capabilities.browserName=='iOS')350 {351 console.log("ESTA EN IOS");352 axios.get("http://localhost:9999"+url).then(resp => {353 console.log(resp.data);354 });355 } else {356 console.log("ESTA EN ANDROID");357 axios.get("http://localhost:8080"+url).then(resp => {358 console.log(resp.data);359 });360 }361 362 });...

Full Screen

Full Screen

xcloud.spec.js

Source:xcloud.spec.js Github

copy

Full Screen

1describe('xCloud', () => {2 it('should not experience long webdriver calls', () => {3 // browser.getLogs('logcat');4 driver.startRecordingScreen();5 driver.takeScreenshot();6 driver.takeScreenshot();7 driver.getPageSource();8 driver.takeScreenshot();9 driver.getPageSource();10 driver.takeScreenshot();11 driver.getPageSource();12 driver.takeScreenshot();13 driver.stopRecordingScreen();14 driver.getCurrentPackage();15 driver.getCurrentActivity();16 driver.getPageSource();17 // browser.getLogs('logcat');18 driver.startRecordingScreen();19 driver.takeScreenshot();20 driver.getPageSource();21 driver.takeScreenshot();22 driver.getPageSource();23 driver.takeScreenshot();24 driver.getPageSource();25 driver.takeScreenshot();26 driver.getPageSource();27 // browser.getLogs('logcat');28 // NO STOPPING!!!!29 driver.startRecordingScreen();30 driver.takeScreenshot();31 driver.takeScreenshot();32 driver.getPageSource();33 driver.takeScreenshot();34 driver.getPageSource();35 driver.takeScreenshot();36 driver.getPageSource();37 driver.takeScreenshot();38 driver.stopRecordingScreen();39 driver.takeScreenshot();40 driver.getPageSource();41 // browser.getLogs('logcat');42 driver.startRecordingScreen();43 for(let i=0; i < 100; i++) {44 driver.pressKeyCode(69);45 }46 driver.takeScreenshot();47 driver.getPageSource();48 driver.takeScreenshot();49 driver.getPageSource();50 driver.takeScreenshot();51 driver.getPageSource();52 driver.stopRecordingScreen();53 driver.takeScreenshot();54 driver.getPageSource();55 // browser.getLogs('logcat');56 driver.startRecordingScreen();57 for(let i=0; i < 100; i++) {58 driver.pressKeyCode(69);59 }60 driver.takeScreenshot();61 driver.getPageSource();62 driver.takeScreenshot();63 driver.getPageSource();64 driver.takeScreenshot();65 driver.getPageSource();66 driver.stopRecordingScreen();67 driver.takeScreenshot();68 driver.getPageSource();69 driver.takeScreenshot();70 driver.getPageSource();71 driver.takeScreenshot();72 driver.getPageSource();73 // browser.getLogs('logcat');74 driver.startRecordingScreen();75 driver.takeScreenshot();76 driver.getPageSource();77 driver.stopRecordingScreen();78 driver.takeScreenshot();79 driver.getPageSource();80 // browser.getLogs('logcat');81 driver.startRecordingScreen();82 driver.takeScreenshot();83 driver.getPageSource();84 driver.takeScreenshot();85 driver.getPageSource();86 driver.takeScreenshot();87 driver.getPageSource();88 driver.stopRecordingScreen();89 driver.takeScreenshot();90 driver.getPageSource();91 driver.takeScreenshot();92 driver.getPageSource();93 driver.takeScreenshot();94 driver.getPageSource();95 // browser.getLogs('logcat');96 driver.startRecordingScreen();97 driver.takeScreenshot();98 driver.getPageSource();99 driver.stopRecordingScreen();100 driver.takeScreenshot();101 driver.getPageSource();102 driver.takeScreenshot();103 driver.getPageSource();104 driver.takeScreenshot();105 driver.getPageSource();106 driver.takeScreenshot();107 driver.getPageSource();108 driver.takeScreenshot();109 driver.getPageSource();110 driver.takeScreenshot();111 driver.getPageSource();112 driver.takeScreenshot();113 driver.getPageSource();114 driver.takeScreenshot();115 driver.getPageSource();116 driver.takeScreenshot();117 driver.getPageSource();118 // VERY STRANGE, NOW THERE IS A STOP119 driver.stopRecordingScreen();120 driver.getPageSource();121 // browser.getLogs('logcat');122 driver.startRecordingScreen();123 driver.takeScreenshot();124 driver.getPageSource();125 driver.stopRecordingScreen();126 driver.getPageSource();127 // browser.getLogs('logcat');128 driver.startRecordingScreen();129 driver.takeScreenshot();130 driver.getPageSource();131 driver.stopRecordingScreen();132 driver.getPageSource();133 // browser.getLogs('logcat');134 driver.startRecordingScreen();135 for(let i=0; i < 100; i++) {136 driver.pressKeyCode(69);137 }138 driver.takeScreenshot();139 driver.getPageSource();140 driver.stopRecordingScreen();141 driver.getPageSource();142 // browser.getLogs('logcat');143 driver.startRecordingScreen();144 driver.takeScreenshot();145 driver.getPageSource();146 driver.stopRecordingScreen();147 driver.getPageSource();148 // browser.getLogs('logcat');149 driver.startRecordingScreen();150 driver.takeScreenshot();151 driver.getPageSource();152 driver.stopRecordingScreen();153 driver.getPageSource();154 // browser.getLogs('logcat');155 driver.startRecordingScreen();156 driver.takeScreenshot();157 driver.getPageSource();158 driver.stopRecordingScreen();159 driver.getPageSource();160 // browser.getLogs('logcat');161 driver.startRecordingScreen();162 for(let i=0; i < 100; i++) {163 driver.pressKeyCode(69);164 }165 driver.takeScreenshot();166 driver.getPageSource();167 driver.stopRecordingScreen();168 driver.getPageSource();169 driver.takeScreenshot();170 driver.getPageSource();171 driver.getPageSource();172 driver.takeScreenshot();173 driver.getPageSource();174 driver.getPageSource();175 driver.takeScreenshot();176 driver.getPageSource();177 driver.getPageSource();178 driver.takeScreenshot();179 driver.getPageSource();180 driver.getPageSource();181 // browser.getLogs('logcat');182 });...

Full Screen

Full Screen

validatepipBySkuSearch.js

Source:validatepipBySkuSearch.js Github

copy

Full Screen

1import {expect as chaiExpect} from 'chai';2describe('Pre-requisites for the script', function() {3 before(function() {4 console.log("Hello World");5 const PROD_BTN = '//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.Button[2]';6 expect ($(PROD_BTN)).toBeDisplayed();7 chaiExpect(2).to.equal(2);8 $(PROD_BTN).click();9 const ALLOW_ACCESS = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button[2]';10 $(ALLOW_ACCESS).click(); 11 const DEVICE_LOCATION = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[1]';12 $(DEVICE_LOCATION).click();13 browser.pause(1000);14 const TST_ICON = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText';15 $(TST_ICON).click();16 const PIN_CODE = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText';17 $(PIN_CODE).setValue('M2J2K2');18 driver.pressKeyCode(66);19 browser.pause(5000);20 const STORE = '~SCARBOROUGH #7001';21 $(STORE).click();22 browser.pause(2000);23 });24 it('Given the user enter the SKU and searches for the result', function() {25 const HOMEPAGE_IMG = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout[2]/android.widget.ImageView[1]';26 $(HOMEPAGE_IMG).click();27 browser.pause(2000);28 29 const SEARCH_ICON = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ImageView[1]';30 $(SEARCH_ICON).click();31 browser.pause(3000);32 33 const SEARCH_TXT = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.RelativeLayout/android.view.ViewGroup[1]/android.widget.RelativeLayout/android.widget.EditText';34 $(SEARCH_TXT).setValue(1000102904);35 browser.pause(1000);36 //driver.executeScript((SEARCH_TXT)).type('Hammer').click().execute( "mobile: performEditorAction", { "action": "search" } );37 //driver.pressKeyCode(84);38 39 40 //driver.execute_script("mobile:performEditorAction", {'action':'search'});41 //driver.waitForElementById($(SEARCH_TXT)).type('Hammer').click().execute( "mobile: performEditorAction", { "action": "search" } );42 //driver.waitForElementById(SEARCH_TXT).type("Hammer").click().execute( "mobile: performEditorAction", { "action": "search" } );43 // const HOMEPAGE_SEARCHTXT = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.EditText';44 // $(HOMEPAGE_SEARCHTXT).click();45 // $(HOMEPAGE_SEARCHTXT).setValue(1000102904);46 // // browser.pause(1000);47 // driver.pressKeyCode(66);48 });49 // it('Then I validate that the PIP page is loaded correctly', function() { 50 // console.log("PIP page loaded successfully");51 // });...

Full Screen

Full Screen

validatepipByTextSearch.js

Source:validatepipByTextSearch.js Github

copy

Full Screen

1import {expect as chaiExpect} from 'chai';2describe('Pre-requisites for the script', function() {3 before(function() {4 console.log("Hello World");5 const PROD_BTN = '//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.Button[2]';6 expect ($(PROD_BTN)).toBeDisplayed();7 chaiExpect(2).to.equal(2);8 $(PROD_BTN).click();9 const ALLOW_ACCESS = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button[2]';10 $(ALLOW_ACCESS).click(); 11 const DEVICE_LOCATION = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[1]';12 $(DEVICE_LOCATION).click();13 browser.pause(1000);14 const TST_ICON = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText';15 $(TST_ICON).click();16 const PIN_CODE = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText';17 $(PIN_CODE).setValue('M2J2K2');18 driver.pressKeyCode(66);19 browser.pause(5000);20 const STORE = '~SCARBOROUGH #7001';21 $(STORE).click();22 browser.pause(2000);23 });24 it('Given the user enter the SKU and searches for the result', function() {25 const HOMEPAGE_IMG = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout[2]/android.widget.ImageView[1]';26 $(HOMEPAGE_IMG).click();27 browser.pause(2000);28 29 const SEARCH_ICON = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ImageView[1]';30 $(SEARCH_ICON).click();31 browser.pause(3000);32 33 const SEARCH_TXT = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.RelativeLayout/android.view.ViewGroup[1]/android.widget.RelativeLayout/android.widget.EditText';34 $(SEARCH_TXT).setValue('Hammer');35 browser.pause(1000);36 driver.pressKeyCode(66);37 // const HOMEPAGE_SEARCHTXT = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.FrameLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.EditText';38 // $(HOMEPAGE_SEARCHTXT).click();39 // $(HOMEPAGE_SEARCHTXT).setValue(1000102904);40 // // browser.pause(1000);41 // driver.pressKeyCode(66);42 });...

Full Screen

Full Screen

utils.js

Source:utils.js Github

copy

Full Screen

1/* eslint-disable */2const SELECTORS = {3 ANDROID: {4 TEXT: "*//android.widget.TextView",5 TEXT_FIELD: "*//android.widget.EditText"6 },7 IOS: {8 GENERIC_TEXT: null,9 TEXT_ELEMENT: "-ios predicate string:type == 'XCUIElementTypeStaticText'"10 }11};12/**13 * Get the text of an element (including all child elements)14 *15 * @param {element} element16 * @param {boolean} isXpath17 *18 * @return {string}19 */20export function getTextOfElement(element, isXpath = false) {21 let visualText;22 try {23 if (driver.isAndroid) {24 visualText = element25 .$$(SELECTORS.ANDROID.TEXT)26 .reduce((currentValue, el) => `${currentValue} ${el.getText()}`, "");27 } else {28 const iosElement = isXpath29 ? element.$$(SELECTORS.IOS.TEXT_ELEMENT)30 : element;31 if (isXpath) {32 visualText = element33 .$$(SELECTORS.IOS.TEXT_ELEMENT)34 .reduce((currentValue, el) => `${currentValue} ${el.getText()}`, "");35 } else {36 visualText = iosElement.getText();37 }38 }39 } catch (e) {40 visualText = element.getText();41 }42 return visualText.trim();43}44/**45 * Get the time difference in seconds46 *47 * @param {number} start the time in milliseconds48 * @param {number} end the time in milliseconds49 */50export function timeDifference(start, end) {51 const elapsed = (end - start) / 1000;52 console.log("elapsed = ", elapsed, " seconds");53}54 const keyPress = async (number) => {55 var keyCode = 0;56 for (const num of number.split('')) {57 switch (num) {58 case '0': await driver.pressKeyCode(7); break;59 case '1': await driver.pressKeyCode(8); break;60 case '2': await driver.pressKeyCode(9); break;61 case '3': await driver.pressKeyCode(10); break;62 case '4': await driver.pressKeyCode(11); break; 63 case '5': await driver.pressKeyCode(12); break; 64 case '6': await driver.pressKeyCode(13); break; 65 case '7': await driver.pressKeyCode(14); break; 66 case '8': await driver.pressKeyCode(15); break; 67 case '9': await driver.pressKeyCode(16); break; 68 }69 }70}71/**72 * tap element on finding by position.73 *74 * @param {string} text 75 */76const tapElementByPositionOCR = async (text) => {77 var position = await driver.ocrGetElementPositionByText(text)78 await driver.touchAction({79 action: 'tap',80 x: position.originalPosition.left,81 y: position.originalPosition.top82 })83}84/**85 * Order arrays86 *87 * @param {array} to return in correct order88 */89async function asyncForEach(array, callback) {90 for (let index = 0; index < array.length; index++) {91 await callback(array[index], index, array);92 }93}94function addSeperator(nStr){95 96 nStr += '';97 var x = nStr.split('.');98 var x1 = x[0];99 var x2 = x.length > 1 ? ',' + x[1] : '';100 var rgx = /(\d+)(\d{3})/;101 while (rgx.test(x1)) {102 x1 = x1.replace(rgx, '$1' + '.' + '$2');103 }104 return x1 + x2;105}...

Full Screen

Full Screen

login.js

Source:login.js Github

copy

Full Screen

1const assert = require('assert');2describe('login', function() {3 it('user should be login the application successfully', async function() {4 const userEmail = 'jane_doe@google.com';5 const userPassword = '123456';6 const userName = 'Jane Doe';7 const username = await $('//android.widget.EditText[@resource-id="com.example.creativedock:id/username"]');8 await username.waitForDisplayed();9 await username.click();10 await username.setValue(userEmail);11 /*12 * The follwoing code is needed because if we simply insert the value in username field via automation then validation error does not disappear.13 * To get rid of validation error we need to send some event from keyboard.14 * For that just pressing right arrow key then space key and then pressing backspace key so the effect will be neutral.15 */16 driver.pressKeyCode(22); // Right Key17 driver.pressKeyCode(62); // Space Key18 driver.pressKeyCode(67); // Backspace Key19 20 const password = await $('//android.widget.EditText[@resource-id="com.example.creativedock:id/password"]');21 await password.waitForDisplayed();22 await password.click();23 await password.setValue(userPassword);24 /*25 * The following code is needed because if we simply insert the value in password field via automation then validation error does not disappear.26 * To get rid of validation error we need to send some event from keyboard.27 * For that just pressing right arrow key then space key and then pressing backspace key so the effect will be neutral.28 */29 driver.pressKeyCode(22); // Right Key30 driver.pressKeyCode(62); // Space Key31 driver.pressKeyCode(67); // Backspace Key32 const loginOrRegisterButton = await $('//android.widget.Button[@resource-id="com.example.creativedock:id/login"]');33 await loginOrRegisterButton.waitForDisplayed();34 await loginOrRegisterButton.waitForEnabled();35 await loginOrRegisterButton.click();36 const welcomeToastMessage = await $(`//hierarchy/android.widget.Toast`);37 await welcomeToastMessage.waitForExist({timeout: 3000});38 const welcomeToastMessagetext = await welcomeToastMessage.getText();39 console.log(welcomeToastMessagetext);40 assert.equal(`Welcome !${userName}`, welcomeToastMessagetext);41 });...

Full Screen

Full Screen

App.test.js

Source:App.test.js Github

copy

Full Screen

1var { expect } = require('chai');2describe('Appium Testing', () => {3 // Adding time out to make sure the app is load prior to test is run4 beforeEach(() => {5 // $("~app-root").waitForDisplayed(11000, false)6 });7 it('Photo from Camera-Picker Test', async => {8 $("~btnCamera").click();9 driver.pause(3000);10 driver.pressKeyCode(27);11 driver.pause(5000);12 driver.pressKeyCode(61);13 driver.pause(5000);14 driver.pressKeyCode(108);15 const status = $("~btntype").getText();16 expect(status).to.equal("camera");17 });18 it('Photo from Gallery-Picker Test', async => {19 const fs = require('fs');20 const contents = fs.readFileSync('./images/AI.jpg', { encoding: 'base64' });21 driver.pushFile("/mnt/sdcard/Pictures/test.jpg", contents)22 driver.pause(5000);23 24 $("~btnGallery").click();25 driver.pause(5000);26 driver.touchAction([{ action: 'press', x: 200, y: 1200 }, 'release']); // Special for Galaxy S1027 driver.pause(5000);28 const status = $("~btntype").getText();29 expect(status).to.equal("gallery");30 });31 it('File from Document-Picker Test', async => {32 $("~btnDocument").click();33 driver.pause(7000);34 driver.touchAction([{ action: 'press', x: 286, y: 1257 }, 'release']); // Special for Galaxy S1035 driver.pause(5000);36 37 const status = $("~btntype").getText();38 expect(status).to.equal("document");39 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver'),2 until = webdriver.until;3var driver = new webdriver.Builder()4 .forBrowser('chrome')5 .build();6driver.findElement(By.name('q')).sendKeys('webdriver');7driver.findElement(By.name('btnG')).click();8driver.wait(until.titleIs('webdriver - Google Search'), 1000);9driver.pressKeycode(3);10driver.quit();11var webdriver = require('selenium-webdriver'),12 until = webdriver.until;13var driver = new webdriver.Builder()14 .forBrowser('chrome')15 .build();16driver.findElement(By.name('q')).sendKeys('webdriver');17driver.findElement(By.name('btnG')).click();18driver.wait(until.titleIs('webdriver - Google Search'), 1000);19driver.longPressKeyCode(3);20driver.quit();21var webdriver = require('selenium-webdriver'),22 until = webdriver.until;23var driver = new webdriver.Builder()24 .forBrowser('chrome')25 .build();26driver.findElement(By.name('q')).sendKeys('webdriver');27driver.findElement(By.name('btnG')).click();28driver.wait(until.titleIs('webdriver - Google Search'), 1000);29driver.currentActivity().then(function(activity){30 console.log(activity);31});32driver.quit();33var webdriver = require('selenium-webdriver'),34 until = webdriver.until;35var driver = new webdriver.Builder()36 .forBrowser('chrome')37 .build();38driver.findElement(By.name('q')).sendKeys('webdriver');39driver.findElement(By.name('btnG')).click();40driver.wait(until.titleIs('webdriver - Google Search'), 1000);41driver.startActivity('com.example.android.contactmanager', '.ContactManager');42driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().forBrowser('chrome').build();3driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');4driver.findElement(webdriver.By.name('btnG')).click();5driver.getTitle().then(function(title) {6 console.log(title);7});8driver.quit();9var webdriver = require('selenium-webdriver');10var driver = new webdriver.Builder().forBrowser('chrome').build();11driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');12driver.findElement(webdriver.By.name('btnG')).click();13driver.getTitle().then(function(title) {14 console.log(title);15});16driver.pressKeycode(66);17driver.quit();18var webdriver = require('selenium-webdriver');19var driver = new webdriver.Builder().forBrowser('chrome').build();20driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');21driver.findElement(webdriver.By.name('btnG')).click();22driver.getTitle().then(function(title) {23 console.log(title);24});25driver.pressKeycode(66);26driver.quit();27var webdriver = require('selenium-webdriver');28var driver = new webdriver.Builder().forBrowser('chrome').build();29driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');30driver.findElement(webdriver.By.name('btnG')).click();31driver.getTitle().then(function(title) {32 console.log(title);33});34driver.pressKeycode(66);35driver.quit();36var webdriver = require('selenium-webdriver');37var driver = new webdriver.Builder().forBrowser('chrome').build();38driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');39driver.findElement(webdriver.By.name('btnG')).click();40driver.getTitle().then(function(title) {41 console.log(title);42});43driver.pressKeycode(66);44driver.quit();45var webdriver = require('selenium-webdriver');46var driver = new webdriver.Builder().forBrowser('chrome').build();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2 withCapabilities({3 build();4driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');5driver.findElement(webdriver.By.name('btnG')).click();6driver.sleep(5000).then(function() {7 driver.quit();8});9driver.pressKeycode(4);10driver.pressKeycode(3);11driver.pressKeycode(82);12driver.pressKeycode(66);13driver.pressKeycode(84);14driver.pressKeycode(26);15driver.pressKeycode(24);16driver.pressKeycode(25);17driver.pressKeycode(164);

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6var client = webdriverio.remote(options);7 .init()8 .pressKeycode(82)9 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var driver = wd.promiseChainRemote('localhost', 4723);4var desiredCaps = {5};6driver.init(desiredCaps).then(function() {7 return driver.pressKeycode(82);8}).then(function() {9 console.log('Keycode 82 pressed');10}).fin(function() {11 driver.quit();12});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful