Best JavaScript code snippet using appium
index.js
Source:index.js
...100 await yesOrNotQuestion(101 'Same question now publishing audio from other browser. Try making a noise as you make a gesture. Do you see and hear the gesture at the same time?'102 );103 } catch {}104 driver1.quit();105 driver2.quit();...
test.js
Source:test.js
...27 const fs = require('fs');28 var base64Data = data.replace(/^data:image\/png;base64,/,"")29 fs.writeFile("out1.png", base64Data, 'base64', function(err) {30 if(err) console.log(err);31 driver1.quit();32 });33 }); 34 })35 driver2.get('http://www.heute-show.de');36 driver2.executeScript('$(".header .searchicon").click()');37 driver2.executeScript('$(".header .searchfield").val("merkel")');38 driver2.executeScript('$(".header .searchicon").click()');39 driver2.executeScript('document.body.parentElement.setAttribute("style", "overflow: hidden")'); 40 driver2.wait(until.titleIs('Suche â heute-show | ZDF'), 1000).then( () => {41 driver2.takeScreenshot().then((data) => {42 const fs = require('fs');43 var base64Data = data.replace(/^data:image\/png;base64,/,"")44 fs.writeFile("out2.png", base64Data, 'base64', function(err) {45 if(err) console.log(err);...
driver-e2e-specs.js
Source:driver-e2e-specs.js
...44 let [sessionId2] = await driver2.init(caps);45 should.exist(sessionId2);46 sessionId2.should.be.a('string');47 sessionId1.should.not.equal(sessionId2);48 await driver1.quit();49 await driver2.quit();50 });51 it('should not be able to run two FakeDriver sessions simultaneously when one is unique', async () => {52 let uniqueCaps = _.clone(caps);53 uniqueCaps.uniqueApp = true;54 let driver1 = wd.promiseChainRemote(TEST_HOST, TEST_PORT);55 let [sessionId1] = await driver1.init(uniqueCaps);56 should.exist(sessionId1);57 sessionId1.should.be.a('string');58 let driver2 = wd.promiseChainRemote(TEST_HOST, TEST_PORT);59 await driver2.init(caps).should.eventually.be.rejected;60 await driver1.quit();61 });62 it('should use the newCommandTimeout of the inner Driver on session creation', async () => {63 let driver = wd.promiseChainRemote(TEST_HOST, TEST_PORT);64 caps.newCommandTimeout = 0.25;65 let [sessionId] = await driver.init(caps);66 should.exist(sessionId);67 await B.delay(250);68 await driver.source().should.eventually.be.rejectedWith(/terminated/);69 });70 });...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!