How to use this.sendCommand method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

player.js

Source:player.js Github

copy

Full Screen

...175};176CPlayer.prototype.switchAudio = function() {177 var ret = null;178 if(this.hasAudio()) {179 ret = this.sendCommand("switch_audio", true);180 }181 return ret;182};183CPlayer.prototype.screenshot = function() {184 var ret = null;185 if(this.hasVideo()) {186 ret = this.sendCommand("screenshot 0", true);187 }188 return ret;189};190CPlayer.prototype.switchOsd = function() {191 this.sendCommand('osd', false);192};193CPlayer.prototype.switchSubtitle = function() {194 this.sendCommand('sub_select', false);195};196// Increase speed 10%197CPlayer.prototype.speedUp = function() {198 this.sendCommand('speed_incr 0.1', false);199};200// Decrease speed 10%201CPlayer.prototype.speedDown = function() {202 this.sendCommand('speed_incr -0.1', false);203};204// Set speed (original is 1)205CPlayer.prototype.setSpeed = function(speedVal) {206 var cmdStr = 'speed_set ' + speedVal;207 this.sendCommand(cmdStr, false);208};209CPlayer.prototype.increaseVolume = function() {210 this.sendCommand("volume 1", false);211};212CPlayer.prototype.decreaseVolume = function() {213 this.sendCommand("volume -1", false);214};215CPlayer.prototype.setVolume = function(volValue) {216 var cmdStr = "volume " + volValue + " 1";217 this.sendCommand(cmdStr, false);218};219CPlayer.prototype.getVolume = function() {220 return this.sendCommand("get_property volume", true);221};222// Increase subtitle font223CPlayer.prototype.increaseSubFont = function() {224 this.sendCommand('sub_scale 1', false);225};226// Decrease subtitle font227CPlayer.prototype.decreaseSubFont = function() {228 this.sendCommand('sub_scale -1', false);229};230CPlayer.prototype.subPosUp = function() {231 this.sendCommand('sub_pos 1', false);232};233CPlayer.prototype.subPosDown = function() {234 this.sendCommand('sub_pos -1', false);235};236// Delay subtitle 0.1s237CPlayer.prototype.delaySub = function() {238 this.sendCommand('sub_delay 0.1', false);239};240// Advance subtitle 0.1s241CPlayer.prototype.advanceSub = function() {242 this.sendCommand('sub_delay -0.1', false);243};244// Restet subtitle delay (delayTime unit: ms)245CPlayer.prototype.resetSubDelay = function(delayTime) {246 var cmdStr = "sub_delay " + delayTime/1000 + " 1";247 this.sendCommand(cmdStr, false);248};249// Delay subtitle 0.1s250CPlayer.prototype.delayAudio = function() {251 this.sendCommand('audio_delay 0.1', false);252};253// Advance subtitle 0.1s254CPlayer.prototype.advanceAudio = function() {255 this.sendCommand('audio_delay -0.1', false);256};257// Restet audio delay (delayTime unit: ms)258CPlayer.prototype.resetAudioDelay = function(delayTime) {259 var cmdStr = "audio_delay " + delayTime/1000 + " 1";260 this.sendCommand(cmdStr, false);261};262//------------------- Set Video picture property ------------------263CPlayer.prototype.increaseContrast = function() {264 this.sendCommand('step_property contrast', false);265};266CPlayer.prototype.decreaseContrast = function() {267 this.sendCommand('step_property contrast 0 -1', false);268};269CPlayer.prototype.setContrast = function(val) {270 var cmdStr = 'set_property contrast '+ val;271 this.sendCommand(cmdStr, false);272};273CPlayer.prototype.increaseBright = function() {274 this.sendCommand('step_property brightness', false);275};276CPlayer.prototype.decreaseBright = function() {277 this.sendCommand('step_property brightness 0 -1', false);278};279CPlayer.prototype.setBright = function(val) {280 var cmdStr = 'set_property brightness '+ val;281 this.sendCommand(cmdStr, false);282};283CPlayer.prototype.increaseHue = function() {284 this.sendCommand('step_property hue', false);285};286CPlayer.prototype.decreaseHue = function() {287 this.sendCommand('step_property hue 0 -1', false);288};289CPlayer.prototype.setBright = function(val) {290 var cmdStr = 'set_property hue '+ val;291 this.sendCommand(cmdStr, false);292};293CPlayer.prototype.increaseSaturation = function() {294 this.sendCommand('step_property saturation', false);295};296CPlayer.prototype.decreaseSaturation = function() {297 this.sendCommand('step_property saturation 0 -1', false);298};299CPlayer.prototype.setSaturation = function(val) {300 var cmdStr = 'set_property saturation '+ val;301 this.sendCommand(cmdStr, false);302};303CPlayer.prototype.increaseGamma = function() {304 this.sendCommand('step_property gamma', false);305};306CPlayer.prototype.decreaseGamma = function() {307 this.sendCommand('step_property gamma 0 -1', false);308};309CPlayer.prototype.setGamma = function(val) {310 var cmdStr = 'set_property gamma '+ val;311 this.sendCommand(cmdStr, false);312};313//------------------- Callback function ---------------------------314CPlayer.prototype.setStartCallback = function(func) {315 this.startCallback = func;316};317CPlayer.prototype.setPauseCallback = function(func) {318 this.pauseCallback = func;319};320CPlayer.prototype.setStopCallback = function(func) {321 this.stopCallback = func;322};323CPlayer.prototype.setLoopCallback = function(func) {324 this.loopCallback = func;325};...

Full Screen

Full Screen

bedrest.js

Source:bedrest.js Github

copy

Full Screen

...50 /**51 * Registers event handlers with the DOM.52 */53 register() {54 document.getElementById("button_flat").addEventListener("click", () => this.sendCommand("flat"), false);55 document.getElementById("button_zerog").addEventListener("click", () => this.sendCommand("zerog"), false);56 document.getElementById("button_antisnore").addEventListener("click", () => this.sendCommand("antisnore"), false);57 document.getElementById("button_nightlight").addEventListener("click", () => this.sendCommand("lighttoggle"), false);58 document.getElementById("button_fullbody").addEventListener("click", () => this.sendCommandArg("fullbodymassage", 0x41), false);59 document.getElementById("button_stopmassage").addEventListener("click", () => this.sendCommand("stopmassage"), false);60 document.getElementById("button_headup").addEventListener("mousedown", () => this.sendCommand("headup"), false);61 document.getElementById("button_headup").addEventListener("mouseup", () => this.sendCommand("stopmotion"), false);62 document.getElementById("button_headdown").addEventListener("mousedown", () => this.sendCommand("headdown"), false);63 document.getElementById("button_headdown").addEventListener("mouseup", () => this.sendCommand("stopmotion"), false);64 document.getElementById("button_feetup").addEventListener("mousedown", () => this.sendCommand("footup"), false);65 document.getElementById("button_feetup").addEventListener("mouseup", () => this.sendCommand("stopmotion"), false);66 document.getElementById("button_feetdown").addEventListener("mousedown", () => this.sendCommand("footdown"), false);67 document.getElementById("button_feetdown").addEventListener("mouseup", () => this.sendCommand("stopmotion"), false);68 document.getElementById("button_headmassageup").addEventListener("mousedown", () => this.sendCommand("massageheadup"), false);69 document.getElementById("button_headmassageup").addEventListener("mouseup", () => this.sendCommand("stopmassagemotion"), false);70 document.getElementById("button_headmassagedown").addEventListener("mousedown", () => this.sendCommand("massageheaddown"), false);71 document.getElementById("button_headmassagedown").addEventListener("mouseup", () => this.sendCommand("stopmassagemotion"), false);72 document.getElementById("button_footmassageup").addEventListener("mousedown", () => this.sendCommand("massagefootup"), false);73 document.getElementById("button_footmassageup").addEventListener("mouseup", () => this.sendCommand("stopmassagemotion"), false);74 document.getElementById("button_footmassagedown").addEventListener("mousedown", () => this.sendCommand("massagefootdown"), false);75 document.getElementById("button_footmassagedown").addEventListener("mouseup", () => this.sendCommand("stopmassagemotion"), false);76 document.getElementById("button_preset_1").addEventListener("click", () => this.sendCommand("memrecall1"), false);77 document.getElementById("button_preset_2").addEventListener("click", () => this.sendCommand("memrecall2"), false);78 document.getElementById("button_preset_3").addEventListener("click", () => this.sendCommand("memrecall3"), false);79 document.getElementById("button_preset_4").addEventListener("click", () => this.sendCommand("memrecall4"), false);80 document.getElementById("head_abs").addEventListener("change", (evt) => this.changeSlider("headposition", document.getElementById("head_abs"), document.getElementById("head_abs_num"), document.getElementById("head_abs").value), false);81 document.getElementById("head_abs_num").addEventListener("change", (evt) => this.changeSlider("headposition", document.getElementById("head_abs"), document.getElementById("head_abs_num"), document.getElementById("head_abs_num").value), false);82 83 document.getElementById("foot_abs").addEventListener("change", (evt) => this.changeSlider("footposition", document.getElementById("foot_abs"), document.getElementById("foot_abs_num"), document.getElementById("foot_abs").value), false);84 document.getElementById("foot_abs_num").addEventListener("change", (evt) => this.changeSlider("footposition", document.getElementById("foot_abs"), document.getElementById("foot_abs_num"), document.getElementById("foot_abs_num").value), false);85 86 document.getElementById("head_mass_abs").addEventListener("change", (evt) => this.changeSlider("headmassage", document.getElementById("head_mass_abs"), document.getElementById("head_mass_abs_num"), document.getElementById("head_mass_abs").value), false);87 document.getElementById("head_mass_abs_num").addEventListener("change", (evt) => this.changeSlider("headmassage", document.getElementById("head_mass_abs"), document.getElementById("head_mass_abs_num"), document.getElementById("head_mass_abs_num").value), false);88 89 document.getElementById("foot_mass_abs").addEventListener("change", (evt) => this.changeSlider("footmassage", document.getElementById("foot_mass_abs"), document.getElementById("foot_mass_abs_num"), document.getElementById("foot_mass_abs").value), false);90 document.getElementById("foot_mass_abs_num").addEventListener("change", (evt) => this.changeSlider("footmassage", document.getElementById("foot_mass_abs"), document.getElementById("foot_mass_abs_num"), document.getElementById("foot_mass_abs_num").value), false);91 92 //Add keyboard shortcuts.93 window.addEventListener("keypress", (evt) => {94 if(evt.key === "A" || evt.key === "a") {95 this.sendCommand("antisnore");96 } else if(evt.key === "Z" || evt.key === "z") {97 this.sendCommand("zerog");98 } else if(evt.key === "L" || evt.key === "l") {99 this.sendCommand("lighttoggle");100 }101 });102 //Populate our dropdown list of beds.103 let select = document.getElementById("bedselect");104 select.options.length = 0;105 Object.keys(this.beds).forEach((key) => select.options[select.options.length] = new Option(this.beds[key], key));106 }107 changeSlider(cmd, slider, input, val) {108 slider.value = val;109 input.value = val;110 val = parseInt(val);111 if(cmd === "headmassage" || cmd === "footmassage") {112 val *= 10;113 }...

Full Screen

Full Screen

plan.js

Source:plan.js Github

copy

Full Screen

...44 onChange={(e, value) => this.setState({ boxId: value })}45 />46 </div>47 </div>48 <RaisedButton label="获取状态" disabled={!boxId} onTouchTap={_ => this.sendCommand(6)}/>65649 <RaisedButton label="启动" disabled={!boxId} onTouchTap={_ => this.sendCommand(0)}/>50 <RaisedButton label="关闭" disabled={!boxId} onTouchTap={_ => this.sendCommand(4)}/>51 <RaisedButton label="设防" disabled={!boxId} onTouchTap={_ => this.sendCommand(1)}/>52 <RaisedButton label="撤防" disabled={!boxId} onTouchTap={_ => this.sendCommand(5)}/>53 <RaisedButton label="寻车" disabled={!boxId} onTouchTap={_ => this.sendCommand(2)}/>54 <RaisedButton label="打开电池仓" disabled={!boxId} onTouchTap={_ => this.sendCommand(10)}/>55 <RaisedButton label="设置/播放声音" disabled={!boxId} onTouchTap={_ => {56 this.onOpenDialog('设置/播放声音', (57 <div>58 {Object.keys(this.BK_BOX_SOUND).map((key, index) => {59 const idx = this.BK_BOX_SOUND[key];60 return (61 <div62 key={index}63 className="search-row"64 >65 <span className="search-row-label" style={{ width: 180 }}>{key}</span>66 <SingleInput67 resetAfterDone={false}68 style={{ width: 400 }}69 name={key}70 defaultValue={`http://mangoebike.oss-cn-shenzhen.aliyuncs.com/amrs/${index}.amr`}71 onDone={value => {72 this.sendCommand(13, { idx, url: value });73 }}74 />75 <IconButton onTouchTap={_ => {76 this.sendCommand(9, { idx })77 }}><IconPlay/></IconButton>78 </div>79 );80 })}81 </div>82 ), [83 <FlatButton label="关闭" onTouchTap={_ => this.onCloseDialog()}/>84 ]);85 }}/>86 <RaisedButton label="关机" disabled={!boxId} onTouchTap={_ => this.sendCommand(7)}/>87 <RaisedButton label="重置" disabled={!boxId} onTouchTap={_ => this.sendCommand(8)}/>88 <RaisedButton label="转网" disabled={!boxId} onTouchTap={_ => {89 this.onOpenDialog('填入网关地址', (90 <div>91 <span>自定义</span>92 <SingleInput93 name="server"94 defaultValue="mangguo.xiaoantech.com:9880"95 onDone={value => {96 this.sendCommand(11, { server: value });97 this.onCloseDialog();98 }}99 />100 <RaisedButton101 label="转到本地"102 onTouchTap={_ => {103 this.sendCommand(11, { server: '112.74.132.53:9085' });104 this.onCloseDialog();105 }}106 />107 <RaisedButton108 label="转到远程"109 onTouchTap={_ => {110 this.sendCommand(11, { server: '120.77.89.97:84' });111 this.onCloseDialog();112 }}113 />114 <RaisedButton115 label="转到新远程"116 onTouchTap={_ => {117 this.sendCommand(11, { server: '120.25.135.178:4007' });118 this.onCloseDialog();119 }}120 />121 </div>122 ), [123 <FlatButton label="放弃" onTouchTap={_ => this.onCloseDialog()}/>124 ]);125 }}/>126 <RaisedButton label="远程升级" disabled={!boxId} onTouchTap={_ => this.sendCommand(12)}/>127 <RaisedButton128 label="设置省电"129 disabled={!boxId}130 onTouchTap={_ => this.sendCommand(14, { mode: 1, freq_eco: 3600 })}131 />132 <RaisedButton133 label="设置正常"134 disabled={!boxId}135 onTouchTap={_ => this.sendCommand(14, { mode: 0 })}136 />137 {this.renderInfo()}138 </div>139 );140 }...

Full Screen

Full Screen

FlightControls.js

Source:FlightControls.js Github

copy

Full Screen

...124 })125 }126 startNeuroSky() {127 debugger128 this.sendCommand('enable-neurosky')()129 this.setState({ neuroskyEnabled: true })130 }131 stopNeuroSky() {132 debugger133 this.sendCommand('disable-neurosky')()134 this.setState({ neuroskyEnabled: false })135 }136 startUltracortex() {137 this.sendCommand('enable-ultracortex')()138 this.setState({ ultracortexEnabled: true })139 }140 stopUltracortex() {141 this.sendCommand('disable-ultracortex')()142 this.setState({ ultracortexEnabled: false })143 }144 onKeydown(e) {145 switch (e.which) {146 case keys.SPACE:147 if (this.state.status === 'landed') {148 this.sendCommand('takeoff')()149 } else {150 this.sendCommand('land')()151 }152 break153 case keys.ARROW_RIGHT:154 console.log('RIGHT')155 if (!e.shiftKey) {156 this.sendCommand('move', { directon: 'right' })()157 } else {158 this.sendCommand('turn', { directon: 'right' })()159 }160 break161 case keys.ARROW_LEFT:162 console.log('LEFT')163 if (!e.shiftKey) {164 this.sendCommand('move', { directon: 'left' })()165 } else {166 this.sendCommand('turn', { directon: 'left' })()167 }168 break169 case keys.ARROW_UP:170 console.log('UP')171 if (!e.shiftKey) {172 this.sendCommand('move', { directon: 'forward' })()173 } else {174 this.sendCommand('move', { directon: 'up' })()175 }176 break177 case keys.ARROW_DOWN:178 console.log('DOWN')179 if (!e.shiftKey) {180 this.sendCommand('move', { directon: 'backward' })()181 } else {182 this.sendCommand('move', { directon: 'down' })()183 }184 break185 default:186 }187 }188 sendCommand(command, commandOptions = null) {189 return () => {190 console.log(191 `Sending the command ${command} ${JSON.stringify(commandOptions)}`192 )193 if (commandOptions) {194 socket.emit(command, commandOptions)195 } else {196 socket.emit(command, command)197 }198 }199 }200 render() {201 return (202 <div>203 <Title>Flight Control Center</Title>204 <Grid>205 {/* <h2>206 Status:207 {this.state.status}208 </h2> */}209 <button className="rotate" onClick={this.sendCommand('ccw 90')}>210 <span className="symbol">⟲</span> left 90°211 </button>212 <button213 onClick={this.sendCommand('move', {214 direction: 'forward',215 speed: amount,216 })}217 >218 <span className="symbol">↑</span> forward {amount}cm219 </button>220 <button className="rotate" onClick={this.sendCommand('cw 90')}>221 <span className="symbol">⟳</span> right 90°222 </button>223 <button onClick={this.sendCommand('turn', { direction: 'left' })}>224 <span className="symbol">←</span> left {amount}cm225 </button>226 <div className="center">227 {this.state.status === status.LANDED ? (228 <button className="takeoff" onClick={this.sendCommand('takeoff')}>229 Take Off230 </button>231 ) : (232 <button className="land" onClick={this.sendCommand('land')}>233 Land {this.state.status}234 </button>235 )}236 <button237 className="emergency"238 onClick={this.sendCommand('emergency')}239 >240 emergency241 </button>242 </div>243 <button onClick={this.sendCommand('turn', { direction: 'right' })}>244 <span className="symbol">→</span>245 right {amount}cm246 </button>247 <button248 className="height"249 onClick={this.sendCommand('move', {250 direction: 'up',251 speed: amount,252 })}253 >254 <span className="symbol">⤒</span> raise {amount}cm255 </button>256 <button257 onClick={this.sendCommand('move', {258 direction: 'backward',259 speed: amount,260 })}261 >262 <span className="symbol">↓</span> back {amount}cm263 </button>264 <button265 className="height"266 onClick={this.sendCommand('move', {267 direction: 'down',268 speed: amount,269 })}270 >271 <span className="symbol">⤓</span> lower {amount}cm272 </button>273 </Grid>274 <div style={{ paddingTop: '50px' }}>275 <HeadsetControl>276 <span>NeuroSky: </span>277 {this.state.neuroskyEnabled ? (278 <button279 style={{ backgroundColor: '#e76f51' }}280 onClick={this.stopNeuroSky}...

Full Screen

Full Screen

device.js

Source:device.js Github

copy

Full Screen

...69 /**70 * Power on/off the device71 */72 powerOn(power: string, effect: string, duration: number): Promise<> {73 return this.sendCommand({ id: this.id, method: 'set_power', params: [power, effect, duration] });74 }75 getProp(props: Array<string>): Promise<> {76 return this.sendCommand({ id: this.id, method: 'get_prop', params: props });77 }78 setCtAbx(ctValue: number, effect: string, duration: number): Promise<> {79 return this.sendCommand({ id: this.id, method: 'set_ct_abx', params: [ctValue, effect, duration] });80 }81 setRgb(rgbValue: number, effect: string, duration: number): Promise<> {82 return this.sendCommand({ id: this.id, method: 'set_rgb', params: [rgbValue, effect, duration] });83 }84 setHsv(hue: number, sat: number, effect: string, duration: number): Promise<> {85 return this.sendCommand({ id: this.id, method: 'set_hsv', params: [hue, sat, effect, duration] });86 }87 setBright(brightness: number, effect: string, duration: number): Promise<> {88 return this.sendCommand({ id: this.id, method: 'set_bright', params: [brightness, effect, duration] });89 }90 toggle(): Promise<> {91 return this.sendCommand({ id: this.id, method: 'toggle', params: [] });92 }93 default(): Promise<> {94 return this.sendCommand({ id: this.id, method: 'default', params: [] });95 }96 startCf(count: number, action: number, flowExpression: string): Promise<> {97 return this.sendCommand({ id: this.id, method: 'start_cf', params: [count, action, flowExpression] });98 }99 stopCf(): Promise<> {100 return this.sendCommand({ id: this.id, method: 'stop_cf', params: [] });101 }102 setScene(name: string, val1: number, val2: number, val3: number): Promise<> {103 return this.sendCommand({ id: this.id, method: 'set_scene', params: [name, val1, val2, val3] });104 }105 cronAdd(type: number, value: number): Promise<> {106 return this.sendCommand({ id: this.id, method: 'cron_add', params: [type, value] });107 }108 cronGet(type: number): Promise<> {109 return this.sendCommand({ id: this.id, method: 'cron_get', params: [type] });110 }111 cronDel(type: number): Promise<> {112 return this.sendCommand({ id: this.id, method: 'cron_del', params: [type] });113 }114 setAdjust(action: string, prop: string): Promise<> {115 return this.sendCommand({ id: this.id, method: 'set_adjust', params: [action, prop] });116 }117 setMusic(action: number, host: string, port: number): Promise<> {118 return this.sendCommand({ id: this.id, method: 'set_music', params: [action, host, port] });119 }120 setName(name: string): Promise<> {121 return this.sendCommand({ id: this.id, method: 'set_name', params: [name] });122 }123}...

Full Screen

Full Screen

arduinoZ.js

Source:arduinoZ.js Github

copy

Full Screen

...62 }63 64 setRefVal(){65 return new Promise((resolve,reject) => {66 this.sendCommand('X')67 .then(resolve)68 .catch(reject);69 });70 }71 getSensVal(){72 return new Promise((resolve, reject) => {73 this.receiveData('Y')74 // promiseDelay(500)75 // .then(this.receiveData('Y'))76 .then(resolve)77 .catch(reject)78 })79 }80 getVol(){81 return new Promise((resolve, reject) => {82 this.receiveData('Z')83 // promiseDelay(500)84 // .then(this.receiveData('Z'))85 .then(resolve)86 .catch(reject)87 })88 }89 90////////////////////////////////////////////////////91 move2M(){92 return new Promise((resolve,reject) => {93 this.sendCommand('O')94 .then(resolve)95 .catch(reject);96 });97 }98 move2P(){99 return new Promise((resolve,reject) => {100 this.sendCommand('P')101 .then(resolve)102 .catch(reject);103 });104 }105 move2TarVal(){106 return new Promise((resolve,reject) => {107 this.sendCommand('S')108 .then(resolve)109 .catch(reject);110 });111 }112 zeroSeek(){113 return new Promise((resolve,reject) => {114 this.sendCommand('N')115 .then(resolve)116 .catch(reject);117 });118 }119 move2moveby(){120 return new Promise((resolve,reject) => {121 this.sendCommand('T')122 .then(resolve)123 .catch(reject);124 });125 }126//////////////////////////////////////////////////////127 move(data){128 return new Promise((resolve, reject) => {129 this.setTarVal(data)130 .then(() => {131 return this.move2TarVal();132 }).then(resolve)133 .catch(reject);134 });135 }136 _ray(time,onDelay){137 // time /= 1000;138 if(onDelay)139 return promisedelay(time);140 else141 return true;142 }143 rayByo(){144 return this.sendCommand('A');145 }146 ray(){147 return this.sendCommand('B');148 }149 laserPower(ONorOFF){150 if(ONorOFF)151 return this.sendCommand('E');152 else 153 return this.sendCommand('F');154 }155 156 rayMicroSec(us){157 return this.setRayTime(us)158 .then(() => {159 return this.ray();160 })161 .catch((e) => {162 console.log("rayMicroSecondError");163 return new Error(e);164 })165 } 166 rayCommand(command){167 return new Promise((resolve, reject) => {168 console.log('raycommand'+command);169 if(typeof(command) !== 'string'){170 reject(new Error('rayCommandの引数がstringではない' + command));171 } else if (command < 'A' || 'K' < command){172 reject(new Error('rayCommandの引数がA~Kの間ではない' + command));173 } else {174 this.sendCommand(command)175 .then(resolve)176 .catch(reject);177 // resolve("plot ok");178 }179 })180 }181//////////////////////////////////////////////////////182 setgetTarTest(data){183 return new Promise((resolve, reject) => {184 this.setTarVal(data)185 .then(() => this.getTarVal())186 .then((d) => {187 if(d === data){188 resolve(new Date());...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...23 });24 });25 }26 async pause() {27 await this.sendCommand('pause', [1]);28 }29 async resume() {30 await this.sendCommand('pause', [0]);31 }32 async next() {33 await this.sendCommand('next', []);34 }35 async previous() {36 await this.sendCommand('previous', []);37 }38 async clearQueue() {39 await this.sendCommand('clear', []);40 }41 async volume(value) {42 if (value > 100) value = 100;43 if (value < 0) value = 0;44 await this.sendCommand('setvol', [value]);45 }46 async seekRel(value) {47 if (value >= 0)48 return await this.sendCommand('seekcur', ["+"+Math.abs(value)]);49 return await this.sendCommand('seekcur', ['-'+Math.abs(value)])50 }51 async currentVolume() {52 return this.data.volume;53 }54 async playing() {55 return this.data.state === 'play';56 }57 async removeFromQueue(id) {58 if (id === -1) {59 id = this.data.song;60 }61 await this.next();62 await this.sendCommand('delete', [id]);63 }64 update() {65 const oldData = this.data;66 return new Promise((resolve, reject) => {67 this.client.sendCommand(mpd.cmd('status', []), (err, msg) => {68 if (err) reject();69 let data = msg.split(/\n/g);70 for (let i in data) {71 let item = data[i];72 item = item.split(': ');73 this.data[item[0]] = item[1];74 }75 resolve(msg);76 });...

Full Screen

Full Screen

GameStateDelegate.js

Source:GameStateDelegate.js Github

copy

Full Screen

...7 this.sockets = new Set()8 }9 didRestartGame = () => {10 let command = new Command(CommandType.restart, " ", Player.server)11 this.sendCommand(command)12 }13 didStartGame = (currentPlayer) => {14 let command = new Command(CommandType.startGame, " ", currentPlayer)15 this.sendCommand(command)16 }17 didEndGame = (winner) => {18 let command = new Command(CommandType.endGame, winner, Player.server)19 this.sendCommand(command)20 }21 didScored = (points, player) => {22 let command = new Command(CommandType.scored, `${points}`, player)23 this.sendCommand(command)24 }25 26 didFlippedCard = (card, player) => {27 let command = new Command(CommandType.playerHasFlipped, `${card}`, player)28 this.sendCommand(command)29 }30 didPlayerHasChosenWrongCards = (cards, player) => {31 let command = new Command(CommandType.wrongCard, `${cards}`, player)32 this.sendCommand(command)33 }34 didClockTicked(counter, counterType) {35 let command = new Command(CommandType.clockTicked, `${counter}!${counterType}`, Player.server)36 this.sendCommand(command)37 }38 didSwitchTurn = (player) => {39 let command = new Command(CommandType.switchTurn, " ", player)40 this.sendCommand(command)41 }42 // Envia os comandos para todas as conexões de socket 43 sendCommand = (command) => {44 for (let socket of this.sockets) {45 socket.write(command.stringfy())46 }47 }48 clockTicked = (counter, countdownType) => {49 let command = new Command(CommandType.clockTicked, `${counter}!${countdownType}`, Player.server)50 this.sendCommand(command)51 }52 ...

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.quit();10var webdriver = require('selenium-webdriver'),11 until = webdriver.until;12var driver = new webdriver.Builder()13 .forBrowser('chrome')14 .build();15driver.findElement(By.name('q')).sendKeys('webdriver');16driver.findElement(By.name('btnG')).click();17driver.wait(until.titleIs('webdriver - Google Search'), 1000);18driver.quit();19var webdriver = require('selenium-webdriver'),20 until = webdriver.until;21var driver = new webdriver.Builder()22 .forBrowser('chrome')23 .build();24driver.findElement(By.name('q')).sendKeys('webdriver');25driver.findElement(By.name('btnG')).click();26driver.wait(until.titleIs('webdriver - Google Search'), 1000);27driver.quit();28var webdriver = require('selenium-webdriver'),29 until = webdriver.until;30var driver = new webdriver.Builder()31 .forBrowser('chrome')32 .build();33driver.findElement(By.name('q')).sendKeys('webdriver');34driver.findElement(By.name('btnG')).click();35driver.wait(until.titleIs('webdriver - Google Search'), 1000);36driver.quit();37var webdriver = require('selenium-webdriver'),38 until = webdriver.until;39var driver = new webdriver.Builder()40 .forBrowser('chrome')41 .build();42driver.findElement(By.name('q')).sendKeys('webdriver');43driver.findElement(By.name('btnG')).click();

Full Screen

Using AI Code Generation

copy

Full Screen

1this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})2this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})3this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})4this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})5this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})6this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})7this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})8this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})9this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})10this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})11this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})12this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})13this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})14this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})15this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity', {})16this.sendCommand('GET', '/session/:sessionId/appium/device/current_activity

Full Screen

Using AI Code Generation

copy

Full Screen

1ADB.prototype.sendCommand = function (cmd) {2 var args = _.toArray(arguments).slice(1);3 var cmd = this.adb.defaultArgs.concat(cmd).concat(args);4 return this.adb.shell(cmd);5};6ADB.prototype.shell = function (cmd, cb) {7 return this.exec("shell", cmd).nodeify(cb);8};9systemCallMethods.exec = function () {10 var args = _.toArray(arguments);11 var cmd = args.shift();12 var opts = {13 };14 if (_.last(args) instanceof Function) {15 var cb = args.pop();16 if (_.isObject(_.last(args))) {17 opts = _.defaults(opts, args.pop());18 }19 args.push(opts);20 args.push(function (err, stdout, stderr) {21 if (err) {22 logger.error("Error running " + cmd);23 logger.error("STDOUT: " + stdout);24 logger.error("STDERR: " + stderr);25 return cb(err);26 }27 cb(null, stdout, stderr);28 });29 return exec.apply(this, args);30 } else {31 if (_.isObject(_.last(args))) {32 opts = _.defaults(opts, args.pop());33 }34 args.push(opts);35 return Q.nfapply(exec, args);36 }37};38systemCallMethods.exec = function () {39 var args = _.toArray(arguments);40 var cmd = args.shift();41 var opts = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = new AndroidDriver();2driver.sendCommand('POST', '/session', {desiredCapabilities: {browserName: 'chrome'}}, function(err, res) {3 console.log(err, res);4});5null { sessionId: '1f8e7c82-0a86-4d0d-8d9e-9b9c9b2c2b2e',6 { platform: 'LINUX',7 warnings: {},8 desired: { browserName: 'chrome' },9 { chromedriverVersion: '2.17.343581 (6c9f6e9e6a8f8d2d2a5b6a1c1f5d8f5c5e9b6a5c)',10 userDataDir: '/tmp/.org.chromium.Chromium.5k6aWY' },11 webkitDebugProxyPort: 18181 } }12driver._driver.sendCommand('POST', '/session', {desiredCapabilities: {browserName: 'chrome'}}, function(err, res) {13 console.log(err, res);14});15null { sessionId: 'e9d2f7e8-8f99-4d1f-9e6f-8c1d7e7f9e9f',

Full Screen

Using AI Code Generation

copy

Full Screen

1 it('should be able to send a command to the android driver', async function () {2 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});3 response.should.equal('hello');4 });5 it('should be able to send a command to the ios driver', async function () {6 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});7 response.should.equal('hello');8 });9 it('should be able to send a command to the windows driver', async function () {10 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});11 response.should.equal('hello');12 });13 it('should be able to send a command to the mac driver', async function () {14 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});15 response.should.equal('hello');16 });17 it('should be able to send a command to the web driver', async function () {18 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});19 response.should.equal('hello');20 });21 it('should be able to send a command to the fake driver', async function () {22 let response = await this.driver.sendCommand('mobile: shell', {command: 'echo', args: ['hello']});23 response.should.equal('hello');24 });25});

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.sendCommand('mobile: shell', {command: 'am start -n com.android.settings/.Settings'}, function(err, result) {2 console.log(result);3});4Error: Error executing adbExec. Original error: 'Command '/Users/rahul/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -n com.android.settings/.Settings' exited with code 255'; Stderr: 'Error: Activity class {com.android.settings/.Settings} does not exist'; Code: '255'5driver.sendCommand('mobile: shell', {command: 'am start -n com.android.settings/.Settings'}, function(err, result) {6 console.log(result);7});8Error: Error executing adbExec. Original error: 'Command '/Users/rahul/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -n com.android.settings/.Settings' exited with code 255'; Stderr: 'Error: Activity class {com.android.settings/.Settings} does not exist'; Code: '255'9driver.sendCommand('mobile: shell', {command: 'am start -n com.android.settings/.Settings'}, function(err, result) {10 console.log(result);11});

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 Android Driver 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