How to use getAttribute method in Appium Base Driver

Best JavaScript code snippet using appium-base-driver

VertexArrayFacadeSpec.js

Source:VertexArrayFacadeSpec.js Github

copy

Full Screen

...3435 writer(0, 1.0, 2.0, 3.0); // Write [1.0, 2.0, 3.0] at index zero.36 vaf.commit(); // Commit writes3738 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).toBeDefined();39 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.sizeInBytes).toEqual(1 * 3 * 4);40 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.usage).toEqual(BufferUsage.STATIC_DRAW);41 expect(vaf.va[0].va.getAttribute(0).componentsPerAttribute).toEqual(3);42 expect(vaf.va[0].va.getAttribute(0).componentDatatype).toEqual(ComponentDatatype.FLOAT);43 expect(vaf.va[0].va.getAttribute(0).offsetInBytes).toEqual(0);44 expect(vaf.va[0].va.getAttribute(0).strideInBytes).toEqual(3 * 4);45 });4647 it('resizes a vertex array with static floats', function() {48 var positionIndex = 0;49 var vaf = new VertexArrayFacade(context, [{50 index : positionIndex,51 componentsPerAttribute : 3,52 componentDatatype : ComponentDatatype.FLOAT,53 usage : BufferUsage.STATIC_DRAW54 }], 1);5556 var writer = vaf.writers[positionIndex];57 expect(writer).toBeDefined();5859 writer(0, 1.0, 2.0, 3.0); // Write [1.0, 2.0, 3.0] at index zero.6061 vaf.resize(2); // Two vertices62 writer(1, 1.0, 2.0, 3.0); // Write [4.0, 5.0, 6.0] at index one.63 vaf.commit(); // Commit writes6465 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).toBeDefined();66 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.sizeInBytes).toEqual(2 * 3 * 4);67 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.usage).toEqual(BufferUsage.STATIC_DRAW);68 expect(vaf.va[0].va.getAttribute(0).componentsPerAttribute).toEqual(3);69 expect(vaf.va[0].va.getAttribute(0).componentDatatype).toEqual(ComponentDatatype.FLOAT);70 expect(vaf.va[0].va.getAttribute(0).offsetInBytes).toEqual(0);71 expect(vaf.va[0].va.getAttribute(0).strideInBytes).toEqual(3 * 4);72 });7374 it('creates a vertex array with static floats and unsigned bytes', function() {75 var positionIndex = 0;76 var colorIndex = 2;77 var vaf = new VertexArrayFacade(context, [{78 index : positionIndex,79 componentsPerAttribute : 3,80 componentDatatype : ComponentDatatype.FLOAT,81 usage : BufferUsage.STATIC_DRAW82 }, {83 index : colorIndex,84 componentsPerAttribute : 4,85 componentDatatype : ComponentDatatype.UNSIGNED_BYTE,86 usage : BufferUsage.STATIC_DRAW87 }], 1);8889 var positionWriter = vaf.writers[positionIndex];90 var colorWriter = vaf.writers[colorIndex];9192 expect(positionWriter).toBeDefined();93 expect(colorWriter).toBeDefined();9495 positionWriter(0, 1.0, 2.0, 3.0); // Write position [1.0, 2.0, 3.0] at index zero.96 colorWriter(0, 0, 255, 0, 255); // Write color [0, 255, 0, 255] at index zero.97 vaf.commit(); // Commit writes9899 // Position attribute100 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).toBeDefined();101 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.sizeInBytes).toEqual(1 * ((3 * 4) + (4 * 1)));102 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.usage).toEqual(BufferUsage.STATIC_DRAW);103 expect(vaf.va[0].va.getAttribute(0).componentsPerAttribute).toEqual(3);104 expect(vaf.va[0].va.getAttribute(0).componentDatatype).toEqual(ComponentDatatype.FLOAT);105 expect(vaf.va[0].va.getAttribute(0).offsetInBytes).toEqual(0);106 expect(vaf.va[0].va.getAttribute(0).strideInBytes).toEqual((3 * 4) + (4 * 1));107108 // Color attribute109 expect(vaf.va[0].va.getAttribute(1).vertexBuffer).toEqual(vaf.va[0].va.getAttribute(0).vertexBuffer);110 expect(vaf.va[0].va.getAttribute(1).componentsPerAttribute).toEqual(4);111 expect(vaf.va[0].va.getAttribute(1).componentDatatype).toEqual(ComponentDatatype.UNSIGNED_BYTE);112 expect(vaf.va[0].va.getAttribute(1).offsetInBytes).toEqual(3 * 4);113 expect(vaf.va[0].va.getAttribute(1).strideInBytes).toEqual(vaf.va[0].va.getAttribute(0).strideInBytes);114 });115116 it('creates a vertex array with static and dynamic attributes', function() {117 var positionIndex = 0;118 var txCoordIndex = 2;119 var vaf = new VertexArrayFacade(context, [{120 index : positionIndex,121 componentsPerAttribute : 3,122 componentDatatype : ComponentDatatype.FLOAT,123 usage : BufferUsage.STATIC_DRAW124 }, {125 index : txCoordIndex,126 componentsPerAttribute : 2,127 componentDatatype : ComponentDatatype.UNSIGNED_SHORT,128 usage : BufferUsage.DYNAMIC_DRAW,129 normalize : true130 }], 1);131132 var positionWriter = vaf.writers[positionIndex];133 var txCoordWriter = vaf.writers[txCoordIndex];134135 expect(positionWriter).toBeDefined();136 expect(txCoordWriter).toBeDefined();137138 positionWriter(0, 1.0, 2.0, 3.0);139 txCoordWriter(0, 32 * 1024, 64 * 1024);140 vaf.commit();141142 // Position attribute143 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).toBeDefined();144 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.sizeInBytes).toEqual(1 * (3 * 4));145 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.usage).toEqual(BufferUsage.STATIC_DRAW);146 expect(vaf.va[0].va.getAttribute(0).componentsPerAttribute).toEqual(3);147 expect(vaf.va[0].va.getAttribute(0).componentDatatype).toEqual(ComponentDatatype.FLOAT);148 expect(vaf.va[0].va.getAttribute(0).offsetInBytes).toEqual(0);149 expect(vaf.va[0].va.getAttribute(0).strideInBytes).toEqual(3 * 4);150151 // Texture coordinate attribute152 expect(vaf.va[0].va.getAttribute(1).vertexBuffer).toBeDefined();153 expect(vaf.va[0].va.getAttribute(1).vertexBuffer.sizeInBytes).toEqual(1 * (2 * 2));154 expect(vaf.va[0].va.getAttribute(1).vertexBuffer.usage).toEqual(BufferUsage.DYNAMIC_DRAW);155 expect(vaf.va[0].va.getAttribute(1).componentsPerAttribute).toEqual(2);156 expect(vaf.va[0].va.getAttribute(1).componentDatatype).toEqual(ComponentDatatype.UNSIGNED_SHORT);157 expect(vaf.va[0].va.getAttribute(1).offsetInBytes).toEqual(0);158 expect(vaf.va[0].va.getAttribute(1).strideInBytes).toEqual(2 * 2);159 });160161 it('sub-commits', function() {162 var positionIndex = 0;163 var temperatureIndex = 2;164 var vaf = new VertexArrayFacade(context, [{165 index : positionIndex,166 componentsPerAttribute : 3,167 componentDatatype : ComponentDatatype.FLOAT,168 usage : BufferUsage.STATIC_DRAW169 }, {170 index : temperatureIndex,171 componentsPerAttribute : 1,172 componentDatatype : ComponentDatatype.FLOAT,173 usage : BufferUsage.STREAM_DRAW174 }], 2);175176 var positionWriter = vaf.writers[positionIndex];177 var temperatureWriter = vaf.writers[temperatureIndex];178179 expect(positionWriter).toBeDefined();180 expect(temperatureWriter).toBeDefined();181182 positionWriter(0, 1.0, 2.0, 3.0);183 temperatureWriter(0, 98.6);184 positionWriter(1, 7.0, 8.0, 9.0);185 temperatureWriter(1, 32.0);186 vaf.commit();187188 // Rewrite all vertices189 positionWriter(0, 10.0, 20.0, 30.0);190 temperatureWriter(0, 37.0);191 positionWriter(1, 70.0, 80.0, 90.0);192 temperatureWriter(1, 0.0);193 vaf.commit();194195 // Sub-commit to just one vertex196 temperatureWriter(1, 212.0);197 vaf.subCommit(1, 1);198 vaf.endSubCommits();199200 // Position attribute201 expect(vaf.va[0].va.getAttribute(1).vertexBuffer).toBeDefined();202 expect(vaf.va[0].va.getAttribute(1).vertexBuffer.sizeInBytes).toEqual(2 * (3 * 4));203 expect(vaf.va[0].va.getAttribute(1).vertexBuffer.usage).toEqual(BufferUsage.STATIC_DRAW);204 expect(vaf.va[0].va.getAttribute(1).componentsPerAttribute).toEqual(3);205 expect(vaf.va[0].va.getAttribute(1).componentDatatype).toEqual(ComponentDatatype.FLOAT);206 expect(vaf.va[0].va.getAttribute(1).offsetInBytes).toEqual(0);207 expect(vaf.va[0].va.getAttribute(1).strideInBytes).toEqual(3 * 4);208209 // Temperature attribute210 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).toBeDefined();211 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.sizeInBytes).toEqual(2 * 4);212 expect(vaf.va[0].va.getAttribute(0).vertexBuffer.usage).toEqual(BufferUsage.STREAM_DRAW);213 expect(vaf.va[0].va.getAttribute(0).componentsPerAttribute).toEqual(1);214 expect(vaf.va[0].va.getAttribute(0).componentDatatype).toEqual(ComponentDatatype.FLOAT);215 expect(vaf.va[0].va.getAttribute(0).offsetInBytes).toEqual(0);216 expect(vaf.va[0].va.getAttribute(0).strideInBytes).toEqual(1 * 4);217 });218219 it('destroys previous vertex buffers when number of vertices grows', function() {220 var positionIndex = 0;221 var vaf = new VertexArrayFacade(context, [{222 index : positionIndex,223 componentsPerAttribute : 3,224 componentDatatype : ComponentDatatype.FLOAT,225 usage : BufferUsage.STATIC_DRAW226 }], 1);227228 var writer = vaf.writers[positionIndex];229 expect(writer).toBeDefined();230231 writer(0, 1.0, 2.0, 3.0); // Write [1.0, 2.0, 3.0] at index zero.232 vaf.commit(); // Commit writes233234 // Grab the vertex buffer235 var vbBeforeResize = vaf.va[0].va.getAttribute(0).vertexBuffer;236237 vaf.resize(2); // Two vertices238 writer(1, 1.0, 2.0, 3.0); // Write [4.0, 5.0, 6.0] at index one.239 vaf.commit(); // Commit writes240241 expect(vbBeforeResize.isDestroyed()).toBe(true);242 expect(vaf.va[0].va.getAttribute(0).vertexBuffer).not.toBe(vbBeforeResize);243 });244245 it('is not initially destroyed', function () {246 var positionIndex = 0;247 var vaf = new VertexArrayFacade(context, [{248 index : positionIndex,249 componentsPerAttribute : 3,250 componentDatatype : ComponentDatatype.FLOAT,251 usage : BufferUsage.STATIC_DRAW252 }], 1);253 expect(vaf.isDestroyed()).toBe(false);254 });255256 it('throws when constructed without a context', function() { ...

Full Screen

Full Screen

bind.spec.js

Source:bind.spec.js Github

copy

Full Screen

...4 const vm = new Vue({5 template: '<div><span :test="foo">hello</span></div>',6 data: { foo: 'ok' }7 }).$mount()8 expect(vm.$el.firstChild.getAttribute('test')).toBe('ok')9 vm.foo = 'again'10 waitForUpdate(() => {11 expect(vm.$el.firstChild.getAttribute('test')).toBe('again')12 vm.foo = null13 }).then(() => {14 expect(vm.$el.firstChild.hasAttribute('test')).toBe(false)15 vm.foo = false16 }).then(() => {17 expect(vm.$el.firstChild.hasAttribute('test')).toBe(false)18 vm.foo = true19 }).then(() => {20 expect(vm.$el.firstChild.getAttribute('test')).toBe('true')21 vm.foo = 022 }).then(() => {23 expect(vm.$el.firstChild.getAttribute('test')).toBe('0')24 }).then(done)25 })26 it('should set property for input value', done => {27 const vm = new Vue({28 template: `29 <div>30 <input type="text" :value="foo">31 <input type="checkbox" :checked="bar">32 </div>33 `,34 data: {35 foo: 'ok',36 bar: false37 }38 }).$mount()39 expect(vm.$el.firstChild.value).toBe('ok')40 expect(vm.$el.lastChild.checked).toBe(false)41 vm.bar = true42 waitForUpdate(() => {43 expect(vm.$el.lastChild.checked).toBe(true)44 }).then(done)45 })46 it('xlink', done => {47 const vm = new Vue({48 template: '<svg><a :xlink:special="foo"></a></svg>',49 data: {50 foo: 'ok'51 }52 }).$mount()53 const xlinkNS = 'http://www.w3.org/1999/xlink'54 expect(vm.$el.firstChild.getAttributeNS(xlinkNS, 'special')).toBe('ok')55 vm.foo = 'again'56 waitForUpdate(() => {57 expect(vm.$el.firstChild.getAttributeNS(xlinkNS, 'special')).toBe('again')58 vm.foo = null59 }).then(() => {60 expect(vm.$el.firstChild.hasAttributeNS(xlinkNS, 'special')).toBe(false)61 vm.foo = true62 }).then(() => {63 expect(vm.$el.firstChild.getAttributeNS(xlinkNS, 'special')).toBe('true')64 }).then(done)65 })66 it('enumerated attr', done => {67 const vm = new Vue({68 template: '<div><span :draggable="foo">hello</span></div>',69 data: { foo: true }70 }).$mount()71 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('true')72 vm.foo = 'again'73 waitForUpdate(() => {74 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('true')75 vm.foo = null76 }).then(() => {77 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('false')78 vm.foo = ''79 }).then(() => {80 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('true')81 vm.foo = false82 }).then(() => {83 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('false')84 vm.foo = 'false'85 }).then(() => {86 expect(vm.$el.firstChild.getAttribute('draggable')).toBe('false')87 }).then(done)88 })89 it('boolean attr', done => {90 const vm = new Vue({91 template: '<div><span :disabled="foo">hello</span></div>',92 data: { foo: true }93 }).$mount()94 expect(vm.$el.firstChild.getAttribute('disabled')).toBe('disabled')95 vm.foo = 'again'96 waitForUpdate(() => {97 expect(vm.$el.firstChild.getAttribute('disabled')).toBe('disabled')98 vm.foo = null99 }).then(() => {100 expect(vm.$el.firstChild.hasAttribute('disabled')).toBe(false)101 vm.foo = ''102 }).then(() => {103 expect(vm.$el.firstChild.hasAttribute('disabled')).toBe(true)104 }).then(done)105 })106 it('.prop modifier', () => {107 const vm = new Vue({108 template: '<div><span v-bind:text-content.prop="foo"></span><span :inner-html.prop="bar"></span></div>',109 data: {110 foo: 'hello',111 bar: '<span>qux</span>'112 }113 }).$mount()114 expect(vm.$el.children[0].textContent).toBe('hello')115 expect(vm.$el.children[1].innerHTML).toBe('<span>qux</span>')116 })117 it('.prop modifier with normal attribute binding', () => {118 const vm = new Vue({119 template: '<input :some.prop="some" :id="id">',120 data: {121 some: 'hello',122 id: false123 }124 }).$mount()125 expect(vm.$el.some).toBe('hello')126 expect(vm.$el.getAttribute('id')).toBe(null)127 })128 it('.camel modifier', () => {129 const vm = new Vue({130 template: '<svg :view-box.camel="viewBox"></svg>',131 data: {132 viewBox: '0 0 1 1'133 }134 }).$mount()135 expect(vm.$el.getAttribute('viewBox')).toBe('0 0 1 1')136 })137 it('bind object', done => {138 const vm = new Vue({139 template: '<input v-bind="test">',140 data: {141 test: {142 id: 'test',143 class: 'ok',144 value: 'hello'145 }146 }147 }).$mount()148 expect(vm.$el.getAttribute('id')).toBe('test')149 expect(vm.$el.getAttribute('class')).toBe('ok')150 expect(vm.$el.value).toBe('hello')151 vm.test.id = 'hi'152 vm.test.value = 'bye'153 waitForUpdate(() => {154 expect(vm.$el.getAttribute('id')).toBe('hi')155 expect(vm.$el.getAttribute('class')).toBe('ok')156 expect(vm.$el.value).toBe('bye')157 }).then(done)158 })159 it('bind object with overwrite', done => {160 const vm = new Vue({161 template: '<input v-bind="test" id="foo" :class="test.value">',162 data: {163 test: {164 id: 'test',165 class: 'ok',166 value: 'hello'167 }168 }169 }).$mount()170 expect(vm.$el.getAttribute('id')).toBe('foo')171 expect(vm.$el.getAttribute('class')).toBe('hello')172 expect(vm.$el.value).toBe('hello')173 vm.test.id = 'hi'174 vm.test.value = 'bye'175 waitForUpdate(() => {176 expect(vm.$el.getAttribute('id')).toBe('foo')177 expect(vm.$el.getAttribute('class')).toBe('bye')178 expect(vm.$el.value).toBe('bye')179 }).then(done)180 })181 it('bind object with class/style', done => {182 const vm = new Vue({183 template: '<input class="a" style="color:red" v-bind="test">',184 data: {185 test: {186 id: 'test',187 class: ['b', 'c'],188 style: { fontSize: '12px' }189 }190 }191 }).$mount()192 expect(vm.$el.id).toBe('test')193 expect(vm.$el.className).toBe('a b c')194 expect(vm.$el.style.color).toBe('red')195 expect(vm.$el.style.fontSize).toBe('12px')196 vm.test.id = 'hi'197 vm.test.class = ['d']198 vm.test.style = { fontSize: '14px' }199 waitForUpdate(() => {200 expect(vm.$el.id).toBe('hi')201 expect(vm.$el.className).toBe('a d')202 expect(vm.$el.style.color).toBe('red')203 expect(vm.$el.style.fontSize).toBe('14px')204 }).then(done)205 })206 it('bind object as prop', done => {207 const vm = new Vue({208 template: '<input v-bind.prop="test">',209 data: {210 test: {211 id: 'test',212 className: 'ok',213 value: 'hello'214 }215 }216 }).$mount()217 expect(vm.$el.id).toBe('test')218 expect(vm.$el.className).toBe('ok')219 expect(vm.$el.value).toBe('hello')220 vm.test.id = 'hi'221 vm.test.className = 'okay'222 vm.test.value = 'bye'223 waitForUpdate(() => {224 expect(vm.$el.id).toBe('hi')225 expect(vm.$el.className).toBe('okay')226 expect(vm.$el.value).toBe('bye')227 }).then(done)228 })229 it('bind array', done => {230 const vm = new Vue({231 template: '<input v-bind="test">',232 data: {233 test: [234 { id: 'test', class: 'ok' },235 { value: 'hello' }236 ]237 }238 }).$mount()239 expect(vm.$el.getAttribute('id')).toBe('test')240 expect(vm.$el.getAttribute('class')).toBe('ok')241 expect(vm.$el.value).toBe('hello')242 vm.test[0].id = 'hi'243 vm.test[1].value = 'bye'244 waitForUpdate(() => {245 expect(vm.$el.getAttribute('id')).toBe('hi')246 expect(vm.$el.getAttribute('class')).toBe('ok')247 expect(vm.$el.value).toBe('bye')248 }).then(done)249 })250 it('warn expect object', () => {251 new Vue({252 template: '<input v-bind="test">',253 data: {254 test: 1255 }256 }).$mount()257 expect('v-bind without argument expects an Object or Array value').toHaveBeenWarned()258 })259 it('set value for option element', () => {260 const vm = new Vue({261 template: '<select><option :value="val">val</option></select>',262 data: {263 val: 'val'264 }265 }).$mount()266 // check value attribute267 expect(vm.$el.options[0].getAttribute('value')).toBe('val')268 })269 // a vdom patch edge case where the user has several un-keyed elements of the270 // same tag next to each other, and toggling them.271 it('properly update for toggling un-keyed children', done => {272 const vm = new Vue({273 template: `274 <div>275 <div v-if="ok" id="a" data-test="1"></div>276 <div v-if="!ok" id="b"></div>277 </div>278 `,279 data: {280 ok: true281 }282 }).$mount()283 expect(vm.$el.children[0].id).toBe('a')284 expect(vm.$el.children[0].getAttribute('data-test')).toBe('1')285 vm.ok = false286 waitForUpdate(() => {287 expect(vm.$el.children[0].id).toBe('b')288 expect(vm.$el.children[0].getAttribute('data-test')).toBe(null)289 }).then(done)290 })...

Full Screen

Full Screen

svg_attach.js.uncompressed.js

Source:svg_attach.js.uncompressed.js Github

copy

Full Screen

...81 // summary:82 // deduces a fill style from a node.83 // object: dojox/gfx/shape.Shape84 // an SVG shape85 var fill = object.rawNode.getAttribute("fill");86 if(fill == "none"){87 object.fillStyle = null;88 return;89 }90 var fillStyle = null, gradient = svg.getRef(fill);91 if(gradient){92 switch(gradient.tagName.toLowerCase()){93 case "lineargradient":94 fillStyle = _getGradient(g.defaultLinearGradient, gradient);95 arr.forEach(["x1", "y1", "x2", "y2"], function(x){96 fillStyle[x] = gradient.getAttribute(x);97 });98 break;99 case "radialgradient":100 fillStyle = _getGradient(g.defaultRadialGradient, gradient);101 arr.forEach(["cx", "cy", "r"], function(x){102 fillStyle[x] = gradient.getAttribute(x);103 });104 fillStyle.cx = gradient.getAttribute("cx");105 fillStyle.cy = gradient.getAttribute("cy");106 fillStyle.r = gradient.getAttribute("r");107 break;108 case "pattern":109 fillStyle = lang.clone(g.defaultPattern);110 arr.forEach(["x", "y", "width", "height"], function(x){111 fillStyle[x] = gradient.getAttribute(x);112 });113 fillStyle.src = gradient.firstChild.getAttributeNS(svg.xmlns.xlink, "href");114 break;115 }116 }else{117 fillStyle = new Color(fill);118 var opacity = object.rawNode.getAttribute("fill-opacity");119 if(opacity != null){ fillStyle.a = opacity; }120 }121 object.fillStyle = fillStyle;122 }123 function _getGradient(defaultGradient, gradient){124 var fillStyle = lang.clone(defaultGradient);125 fillStyle.colors = [];126 for(var i = 0; i < gradient.childNodes.length; ++i){127 fillStyle.colors.push({128 offset: gradient.childNodes[i].getAttribute("offset"),129 color: new Color(gradient.childNodes[i].getAttribute("stop-color"))130 });131 }132 return fillStyle;133 }134 function attachStroke(object){135 // summary:136 // deduces a stroke style from a node.137 // object: dojox/gfx/shape.Shape138 // an SVG shape139 var rawNode = object.rawNode, stroke = rawNode.getAttribute("stroke");140 if(stroke == null || stroke == "none"){141 object.strokeStyle = null;142 return;143 }144 var strokeStyle = object.strokeStyle = lang.clone(g.defaultStroke);145 var color = new Color(stroke);146 if(color){147 strokeStyle.color = color;148 strokeStyle.color.a = rawNode.getAttribute("stroke-opacity");149 strokeStyle.width = rawNode.getAttribute("stroke-width");150 strokeStyle.cap = rawNode.getAttribute("stroke-linecap");151 strokeStyle.join = rawNode.getAttribute("stroke-linejoin");152 if(strokeStyle.join == "miter"){153 strokeStyle.join = rawNode.getAttribute("stroke-miterlimit");154 }155 strokeStyle.style = rawNode.getAttribute("dojoGfxStrokeStyle");156 }157 }158 function attachTransform(object){159 // summary:160 // deduces a transformation matrix from a node.161 // object: dojox/gfx/shape.Shape162 // an SVG shape163 var matrix = object.rawNode.getAttribute("transform");164 if(matrix.match(/^matrix\(.+\)$/)){165 var t = matrix.slice(7, -1).split(",");166 object.matrix = Matrix.normalize({167 xx: parseFloat(t[0]), xy: parseFloat(t[2]),168 yx: parseFloat(t[1]), yy: parseFloat(t[3]),169 dx: parseFloat(t[4]), dy: parseFloat(t[5])170 });171 }else{172 object.matrix = null;173 }174 }175 function attachFont(object){176 // summary:177 // deduces a font style from a Node.178 // object: dojox/gfx/shape.Shape179 // an SVG shape180 var fontStyle = object.fontStyle = lang.clone(g.defaultFont),181 r = object.rawNode;182 fontStyle.style = r.getAttribute("font-style");183 fontStyle.variant = r.getAttribute("font-variant");184 fontStyle.weight = r.getAttribute("font-weight");185 fontStyle.size = r.getAttribute("font-size");186 fontStyle.family = r.getAttribute("font-family");187 }188 function attachShape(object, def){189 // summary:190 // builds a shape from a node.191 // object: dojox/gfx/shape.Shape192 // an SVG shape193 // def: Object194 // a default shape template195 var shape = object.shape = lang.clone(def), r = object.rawNode;196 for(var i in shape) {197 shape[i] = r.getAttribute(i);198 }199 }200 function attachRect(object){201 // summary:202 // builds a rectangle shape from a node.203 // object: dojox/gfx/shape.Shape204 // an SVG shape205 attachShape(object, g.defaultRect);206 object.shape.r = Math.min(object.rawNode.getAttribute("rx"), object.rawNode.getAttribute("ry"));207 }208 function attachText(object){209 // summary:210 // builds a text shape from a node.211 // object: dojox/gfx/shape.Shape212 // an SVG shape213 var shape = object.shape = lang.clone(g.defaultText),214 r = object.rawNode;215 shape.x = r.getAttribute("x");216 shape.y = r.getAttribute("y");217 shape.align = r.getAttribute("text-anchor");218 shape.decoration = r.getAttribute("text-decoration");219 shape.rotated = parseFloat(r.getAttribute("rotate")) != 0;220 shape.kerning = r.getAttribute("kerning") == "auto";221 shape.text = r.firstChild.nodeValue;222 }223 function attachTextPath(object){224 // summary:225 // builds a textpath shape from a node.226 // object: dojox/gfx/shape.Shape227 // an SVG shape228 var shape = object.shape = lang.clone(g.defaultTextPath),229 r = object.rawNode;230 shape.align = r.getAttribute("text-anchor");231 shape.decoration = r.getAttribute("text-decoration");232 shape.rotated = parseFloat(r.getAttribute("rotate")) != 0;233 shape.kerning = r.getAttribute("kerning") == "auto";234 shape.text = r.firstChild.nodeValue;235 }236 return svg; // return augmented svg api...

Full Screen

Full Screen

attrs.js

Source:attrs.js Github

copy

Full Screen

...11 var o = {};12 return function () {13 o[key] = "#fc0";14 r.attr(o);15 expect(r.node.getAttribute(key)).to.be("#ffcc00");16 o[key] = "rgb(255, 204, 0)";17 r.attr(o);18 expect(r.node.getAttribute(key)).to.be("#ffcc00");19 o[key] = "hsl(0.1333, 1, .5)";20 r.attr(o);21 expect(r.node.getAttribute(key)).to.be("#ffcc00");22 o[key] = "hsb(0.1333, 1, 1)";23 r.attr(o);24 expect(r.node.getAttribute(key)).to.be("#ffcc00");25 o[key] = "rgba(255, 204, 0, .5)";26 r.attr(o);27 expect(r.node.getAttribute(key)).to.be("rgba(255,204,0,0.5)");28 o[key] = "hsla(0.1333, 1, .5, .5)";29 r.attr(o);30 expect(r.node.getAttribute(key)).to.be("rgba(255,204,0,0.5)");31 o[key] = "hsba(0.1333, 1, 1, .5)";32 r.attr(o);33 expect(r.node.getAttribute(key)).to.be("rgba(255,204,0,0.5)");34 };35 }36 function colorTestStyle(key) {37 var o = {};38 return function () {39 function val() {40 return Snap.color(r.node.getAttribute(key)).hex;41 }42 o[key] = "#fc0";43 r.attr(o);44 expect(val()).to.be("#ffcc00");45 o[key] = "rgb(255, 204, 0)";46 r.attr(o);47 expect(val()).to.be("#ffcc00");48 o[key] = "hsl(0.1333, 1, .5)";49 r.attr(o);50 expect(val()).to.be("#ffcc00");51 o[key] = "hsb(0.1333, 1, 1)";52 r.attr(o);53 expect(val()).to.be("#ffcc00");54 o[key] = "rgba(255, 204, 0, .5)";55 r.attr(o);56 expect(val()).to.be("#ffcc00");57 o[key] = "hsla(0.1333, 1, .5, .5)";58 r.attr(o);59 expect(val()).to.be("#ffcc00");60 o[key] = "hsba(0.1333, 1, 1, .5)";61 r.attr(o);62 expect(val()).to.be("#ffcc00");63 };64 }65 it("sets fill", colorTestProp("fill"));66 it("sets stroke", colorTestStyle("stroke"));67 it("circle core attributes", function () {68 var c = s.circle(10, 20, 30);69 expect(c.node.getAttribute("cx")).to.be("10");70 expect(c.node.getAttribute("cy")).to.be("20");71 expect(c.node.getAttribute("r")).to.be("30");72 c.attr({73 cx: 40,74 cy: 50,75 r: "5%"76 });77 expect(c.node.getAttribute("cx")).to.be("40");78 expect(c.node.getAttribute("cy")).to.be("50");79 expect(c.node.getAttribute("r")).to.be("5%");80 });81 it("rect core attributes", function () {82 var c = s.rect(10, 20, 30, 40);83 expect(c.node.getAttribute("x")).to.be("10");84 expect(c.node.getAttribute("y")).to.be("20");85 expect(c.node.getAttribute("width")).to.be("30");86 expect(c.node.getAttribute("height")).to.be("40");87 c.attr({88 x: 40,89 y: 50,90 width: "5%",91 height: "6%",92 r: 1093 });94 expect(c.node.getAttribute("x")).to.be("40");95 expect(c.node.getAttribute("y")).to.be("50");96 expect(c.node.getAttribute("width")).to.be("5%");97 expect(c.node.getAttribute("height")).to.be("6%");98 expect(c.node.getAttribute("rx")).to.be("10");99 expect(c.node.getAttribute("ry")).to.be("10");100 });101 it("ellipse core attributes", function () {102 var c = s.ellipse(10, 20, 30, 40);103 expect(c.node.getAttribute("cx")).to.be("10");104 expect(c.node.getAttribute("cy")).to.be("20");105 expect(c.node.getAttribute("rx")).to.be("30");106 expect(c.node.getAttribute("ry")).to.be("40");107 c.attr({108 cx: 40,109 cy: 50,110 rx: "5%",111 ry: "6%"112 });113 expect(c.node.getAttribute("cx")).to.be("40");114 expect(c.node.getAttribute("cy")).to.be("50");115 expect(c.node.getAttribute("rx")).to.be("5%");116 expect(c.node.getAttribute("ry")).to.be("6%");117 });118 it("path core attributes", function () {119 var c = s.path("M10,10 110,10");120 expect(c.node.getAttribute("d")).to.be("M10,10 110,10");121 c.attr({d: "M10,10 210,10"});122 expect(c.node.getAttribute("d")).to.be("M10,10 210,10");123 c.attr({path: "M10,10 310,10"});124 expect(c.node.getAttribute("d")).to.be("M10,10 310,10");125 });126 it("text core attributes", function () {127 var c = s.text(10, 15, "testing");128 expect(c.node.getAttribute("x")).to.be("10");129 expect(c.node.getAttribute("y")).to.be("15");130 expect(c.node.textContent).to.be("testing");131 c.attr({132 x: 20,133 y: 25,134 text: "texting"135 });136 expect(c.node.getAttribute("x")).to.be("20");137 expect(c.node.getAttribute("y")).to.be("25");138 expect(c.node.textContent).to.be("texting");139 });140 it("line core attributes", function () {141 var c = s.line(10, 15, 110, 17);142 expect(c.node.getAttribute("x1")).to.be("10");143 expect(c.node.getAttribute("y1")).to.be("15");144 expect(c.node.getAttribute("x2")).to.be("110");145 expect(c.node.getAttribute("y2")).to.be("17");146 c.attr({147 x1: 20,148 y1: 25,149 x2: 220,150 y2: 27151 });152 expect(c.node.getAttribute("x1")).to.be("20");153 expect(c.node.getAttribute("y1")).to.be("25");154 expect(c.node.getAttribute("x2")).to.be("220");155 expect(c.node.getAttribute("y2")).to.be("27");156 });157 it("polyline core attributes", function () {158 var c = s.polyline(10, 15, 20, 25, 30, 35);159 expect(c.node.getAttribute("points")).to.be("10,15,20,25,30,35");160 c.attr({161 points: [20, 25, 30, 35, 40, 45]162 });163 expect(c.node.getAttribute("points")).to.be("20,25,30,35,40,45");164 });165 it("polygon core attributes", function () {166 var c = s.polygon(10, 15, 20, 25, 30, 35);167 expect(c.node.getAttribute("points")).to.be("10,15,20,25,30,35");168 c.attr({169 points: [20, 25, 30, 35, 40, 45]170 });171 expect(c.node.getAttribute("points")).to.be("20,25,30,35,40,45");172 });...

Full Screen

Full Screen

dhtmlxgrid_start.js

Source:dhtmlxgrid_start.js Github

copy

Full Screen

...8function dhtmlXGridFromTable(obj,init){9 if(typeof(obj)!='object')10 obj = document.getElementById(obj);11 var w=document.createElement("DIV");12 w.setAttribute("width",obj.getAttribute("gridWidth")||(obj.offsetWidth?(obj.offsetWidth+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["width"]:(obj.currentStyle?obj.currentStyle["width"]:0)));13 w.setAttribute("height",obj.getAttribute("gridHeight")||(obj.offsetHeight?(obj.offsetHeight+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["height"]:(obj.currentStyle?obj.currentStyle["height"]:0)));14 w.className = obj.className;15 obj.className="";16 if (obj.id) w.id = obj.id;17 var mr=obj;18 var drag=obj.getAttribute("dragAndDrop");19 mr.parentNode.insertBefore(w,mr);20 var f=mr.getAttribute("name")||("name_"+(new Date()).valueOf());21 var windowf=new dhtmlXGridObject(w);22 window[f]=windowf;23 var acs=mr.getAttribute("onbeforeinit");24 var acs2=mr.getAttribute("oninit");25 if (acs) eval(acs);26 windowf.setImagePath(windowf.imgURL||(mr.getAttribute("imgpath")|| mr.getAttribute("image_path") ||""));27 var skin = mr.getAttribute("skin");28 if (skin) windowf.setSkin(skin);29 if (init) init(windowf);30 var hrow=mr.rows[0];31 var za="";32 var zb="";33 var zc="";34 var zd="";35 var ze="";36 for (var i=0; i<hrow.cells.length; i++){37 za+=(za?",":"")+hrow.cells[i].innerHTML;38 var width=hrow.cells[i].getAttribute("width")||hrow.cells[i].offsetWidth||(window.getComputedStyle?window.getComputedStyle(hrow.cells[i],null)["width"]:(hrow.cells[i].currentStyle?hrow.cells[i].currentStyle["width"]:0));39 zb+=(zb?",":"")+(width=="*"?width:parseInt(width));40 zc+=(zc?",":"")+(hrow.cells[i].getAttribute("align")||"left");41 zd+=(zd?",":"")+(hrow.cells[i].getAttribute("type")||"ed");42 ze+=(ze?",":"")+(hrow.cells[i].getAttribute("sort")||"str");43 var f_a=hrow.cells[i].getAttribute("format");44 if (f_a)45 if(hrow.cells[i].getAttribute("type").toLowerCase().indexOf("calendar")!=-1) 46 windowf._dtmask=f_a;47 else48 windowf.setNumberFormat(f_a,i);49 }50 windowf.setHeader(za);51 windowf.setInitWidths(zb)52 windowf.setColAlign(zc)53 windowf.setColTypes(zd);54 windowf.setColSorting(ze);55 if (obj.getAttribute("gridHeight")=="auto")56 windowf.enableAutoHeigth(true);57 if (obj.getAttribute("multiline")) windowf.enableMultiline(true);58 var lmn=mr.getAttribute("lightnavigation");59 if (lmn) windowf.enableLightMouseNavigation(lmn);60 var evr=mr.getAttribute("evenrow");61 var uevr=mr.getAttribute("unevenrow");62 if (evr||uevr) windowf.enableAlterCss(evr,uevr);63 if (drag) windowf.enableDragAndDrop(true);64 windowf.init();65 if (obj.getAttribute("split")) windowf.splitAt(obj.getAttribute("split"));66 windowf.callEvent("onXLS", []);67 //adding rows68 windowf._process_inner_html(mr,1);69 70 if (acs2) eval(acs2); 71 if (obj.parentNode && obj.parentNode.removeChild)72 obj.parentNode.removeChild(obj);73 windowf.callEvent("onXLE", []);74 return windowf;75 }76dhtmlXGridObject.prototype._process_html=function(xml){77 if (xml.tagName && xml.tagName == "TABLE") return this._process_inner_html(xml,0);78 var temp=document.createElement("DIV");79 temp.innerHTML=xml.xmlDoc.responseText;80 var mr = temp.getElementsByTagName("TABLE")[0];81 this._process_inner_html(mr,0);82}83dhtmlXGridObject.prototype._process_inner_html=function(mr,start){84 var n_l=mr.rows.length;85 for (var j=start; j<n_l; j++){86 var id=mr.rows[j].getAttribute("id")||j;87 this.rowsBuffer.push({ idd:id, data:mr.rows[j], _parser: this._process_html_row, _locator:this._get_html_data });88 }89 this.render_dataset();90 this.setSizes();91}92 93dhtmlXGridObject.prototype._process_html_row=function(r,xml){94 var cellsCol = xml.getElementsByTagName('TD');95 var strAr = [];96 97 r._attrs=this._xml_attrs(xml);98 99 //load cell data100 for(var j=0;j<cellsCol.length;j++){101 var cellVal=cellsCol[j];102 var exc=cellVal.getAttribute("type");103 if (r.childNodes[j]){104 if (exc)105 r.childNodes[j]._cellType=exc;106 r.childNodes[j]._attrs=this._xml_attrs(cellsCol[j]);107 }108 109 if (cellVal.firstChild)110 strAr.push(cellVal.innerHTML);111 else strAr.push("");112 113 if (cellVal.colSpan>1){114 r.childNodes[j]._attrs["colspan"]=cellVal.colSpan; 115 for (var k=1; k<cellVal.colSpan; k++){116 strAr.push("")...

Full Screen

Full Screen

v1_1.js

Source:v1_1.js Github

copy

Full Screen

...50 this.readChildNodes(node, obj.putstyles);51 },52 "UserDefinedSymbolization": function(node, obj) {53 var userSymbols = {54 supportSLD: parseInt(node.getAttribute("SupportSLD")) == 1,55 userLayer: parseInt(node.getAttribute("UserLayer")) == 1,56 userStyle: parseInt(node.getAttribute("UserStyle")) == 1,57 remoteWFS: parseInt(node.getAttribute("RemoteWFS")) == 158 };59 obj.userSymbols = userSymbols;60 },61 "LatLonBoundingBox": function(node, obj) {62 obj.llbbox = [63 parseFloat(node.getAttribute("minx")),64 parseFloat(node.getAttribute("miny")),65 parseFloat(node.getAttribute("maxx")),66 parseFloat(node.getAttribute("maxy"))67 ];68 },69 "BoundingBox": function(node, obj) {70 var bbox = OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"].BoundingBox.apply(this, [node, obj]);71 bbox.srs = node.getAttribute("SRS");72 obj.bbox[bbox.srs] = bbox;73 },74 "ScaleHint": function(node, obj) {75 var min = node.getAttribute("min");76 var max = node.getAttribute("max");77 var rad2 = Math.pow(2, 0.5);78 var ipm = OpenLayers.INCHES_PER_UNIT["m"];79 obj.maxScale = parseFloat(80 ((min / rad2) * ipm * 81 OpenLayers.DOTS_PER_INCH).toPrecision(13)82 );83 obj.minScale = parseFloat(84 ((max / rad2) * ipm * 85 OpenLayers.DOTS_PER_INCH).toPrecision(13)86 );87 },88 "Dimension": function(node, obj) {89 var name = node.getAttribute("name").toLowerCase();90 var dim = {91 name: name,92 units: node.getAttribute("units"),93 unitsymbol: node.getAttribute("unitSymbol")94 };95 obj.dimensions[dim.name] = dim;96 },97 "Extent": function(node, obj) {98 var name = node.getAttribute("name").toLowerCase();99 if (name in obj["dimensions"]) {100 var extent = obj.dimensions[name];101 extent.nearestVal = 102 node.getAttribute("nearestValue") === "1";103 extent.multipleVal = 104 node.getAttribute("multipleValues") === "1";105 extent.current = node.getAttribute("current") === "1";106 extent["default"] = node.getAttribute("default") || "";107 var values = this.getChildValue(node);108 extent.values = values.split(",");109 }110 }111 }, OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"])112 },113 CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1" ...

Full Screen

Full Screen

svg_attach.js

Source:svg_attach.js Github

copy

Full Screen

...67s.defNode=_11[0];68return s;69};70function _d(_12){71var _13=_12.rawNode.getAttribute("fill");72if(_13=="none"){73_12.fillStyle=null;74return;75}76var _14=null,_15=_5.getRef(_13);77if(_15){78switch(_15.tagName.toLowerCase()){79case "lineargradient":80_14=_16(g.defaultLinearGradient,_15);81_3.forEach(["x1","y1","x2","y2"],function(x){82_14[x]=_15.getAttribute(x);83});84break;85case "radialgradient":86_14=_16(g.defaultRadialGradient,_15);87_3.forEach(["cx","cy","r"],function(x){88_14[x]=_15.getAttribute(x);89});90_14.cx=_15.getAttribute("cx");91_14.cy=_15.getAttribute("cy");92_14.r=_15.getAttribute("r");93break;94case "pattern":95_14=_2.clone(g.defaultPattern);96_3.forEach(["x","y","width","height"],function(x){97_14[x]=_15.getAttribute(x);98});99_14.src=_15.firstChild.getAttributeNS(_5.xmlns.xlink,"href");100break;101}102}else{103_14=new _4(_13);104var _17=_12.rawNode.getAttribute("fill-opacity");105if(_17!=null){106_14.a=_17;107}108}109_12.fillStyle=_14;110};111function _16(_18,_19){112var _1a=_2.clone(_18);113_1a.colors=[];114for(var i=0;i<_19.childNodes.length;++i){115_1a.colors.push({offset:_19.childNodes[i].getAttribute("offset"),color:new _4(_19.childNodes[i].getAttribute("stop-color"))});116}117return _1a;118};119function _e(_1b){120var _1c=_1b.rawNode,_1d=_1c.getAttribute("stroke");121if(_1d==null||_1d=="none"){122_1b.strokeStyle=null;123return;124}125var _1e=_1b.strokeStyle=_2.clone(g.defaultStroke);126var _1f=new _4(_1d);127if(_1f){128_1e.color=_1f;129_1e.color.a=_1c.getAttribute("stroke-opacity");130_1e.width=_1c.getAttribute("stroke-width");131_1e.cap=_1c.getAttribute("stroke-linecap");132_1e.join=_1c.getAttribute("stroke-linejoin");133if(_1e.join=="miter"){134_1e.join=_1c.getAttribute("stroke-miterlimit");135}136_1e.style=_1c.getAttribute("dojoGfxStrokeStyle");137}138};139function _f(_20){140var _21=_20.rawNode.getAttribute("transform");141if(_21.match(/^matrix\(.+\)$/)){142var t=_21.slice(7,-1).split(",");143_20.matrix=_6.normalize({xx:parseFloat(t[0]),xy:parseFloat(t[2]),yx:parseFloat(t[1]),yy:parseFloat(t[3]),dx:parseFloat(t[4]),dy:parseFloat(t[5])});144}else{145_20.matrix=null;146}147};148function _c(_22){149var _23=_22.fontStyle=_2.clone(g.defaultFont),r=_22.rawNode;150_23.style=r.getAttribute("font-style");151_23.variant=r.getAttribute("font-variant");152_23.weight=r.getAttribute("font-weight");153_23.size=r.getAttribute("font-size");154_23.family=r.getAttribute("font-family");155};156function _9(_24,def){157var _25=_24.shape=_2.clone(def),r=_24.rawNode;158for(var i in _25){159_25[i]=r.getAttribute(i);160}161};162function _8(_26){163_9(_26,g.defaultRect);164_26.shape.r=Math.min(_26.rawNode.getAttribute("rx"),_26.rawNode.getAttribute("ry"));165};166function _b(_27){167var _28=_27.shape=_2.clone(g.defaultText),r=_27.rawNode;168_28.x=r.getAttribute("x");169_28.y=r.getAttribute("y");170_28.align=r.getAttribute("text-anchor");171_28.decoration=r.getAttribute("text-decoration");172_28.rotated=parseFloat(r.getAttribute("rotate"))!=0;173_28.kerning=r.getAttribute("kerning")=="auto";174_28.text=r.firstChild.nodeValue;175};176function _a(_29){177var _2a=_29.shape=_2.clone(g.defaultTextPath),r=_29.rawNode;178_2a.align=r.getAttribute("text-anchor");179_2a.decoration=r.getAttribute("text-decoration");180_2a.rotated=parseFloat(r.getAttribute("rotate"))!=0;181_2a.kerning=r.getAttribute("kerning")=="auto";182_2a.text=r.firstChild.nodeValue;183};184return _5;...

Full Screen

Full Screen

dhtmlxtabbar_start.js

Source:dhtmlxtabbar_start.js Github

copy

Full Screen

2/*3Copyright DHTMLX LTD. http://www.dhtmlx.com4To use this component please contact sales@dhtmlx.com to obtain license5*/6function dhx_init_tabbars(){for(var h=document.getElementsByTagName("div"),g=0;g<h.length;g++)if(h[g].className.indexOf("dhtmlxTabBar")!=-1){var a=h[g],j=a.id;a.className="";for(var f=[],e=0;e<a.childNodes.length;e++)a.childNodes[e].tagName&&a.childNodes[e].tagName!="!"&&(f[f.length]=a.childNodes[e]);var c=new dhtmlXTabBar(j,a.getAttribute("mode")||"top",a.getAttribute("tabheight")||20);window[j]=c;(b=a.getAttribute("onbeforeinit"))&&eval(b);a.getAttribute("enableForceHiding")&&c.enableForceHiding(!0);7c.setImagePath(a.getAttribute("imgpath"));var b=a.getAttribute("margin");if(b!=null)c._margin=b;if(b=a.getAttribute("align"))c._align=b;(b=a.getAttribute("hrefmode"))&&c.setHrefMode(b);b=a.getAttribute("offset");if(b!=null)c._offset=b;b=a.getAttribute("tabstyle");b!=null&&c.setStyle(b);var b=a.getAttribute("select"),i=a.getAttribute("skinColors");i&&c.setSkinColors(i.split(",")[0],i.split(",")[1]);for(e=0;e<f.length;e++){var d=f[e];d.parentNode.removeChild(d);c.addTab(d.id,d.getAttribute("name"),8d.getAttribute("width"),null,d.getAttribute("row"));var k=d.getAttribute("href");k?c.setContentHref(d.id,k):c.setContent(d.id,d);if(!c._dspN&&d.style.display=="none")d.style.display=""}f.length&&c.setTabActive(b||f[0].id);(b=a.getAttribute("oninit"))&&eval(b)}}dhtmlxEvent(window,"load",dhx_init_tabbars);9//v.3.6 build 13041710/*11Copyright DHTMLX LTD. http://www.dhtmlx.com12To use this component please contact sales@dhtmlx.com to obtain license ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = new webdriver.Builder()2 .withCapabilities({3 })4 .build();5var element = driver.findElement(webdriver.By.name('q'));6element.sendKeys('webdriver');7element.submit();8driver.getTitle().then(function(title) {9 console.log('Page title is: ' + title);10});11var element = driver.findElement(webdriver.By.name('q'));12element.sendKeys('webdriver');13element.submit();14driver.getTitle().then(function(title) {15 console.log('Page title is: ' + title);16});17driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2}).build();3driver.findElement(webdriver.By.name('Buttons')).click();4driver.findElement(webdriver.By.name('Rounded')).getAttribute('name').then(function(attrValue) {5 console.log(attrValue);6});7driver.quit();8driver.findElement(webdriver.By.name('Buttons')).click();9driver.findElement(webdriver.By.name('Rounded')).getAttribute('name').then(function(attrValue) {10 console.log(attrValue);11});12driver.quit();13driver.findElement(webdriver.By.name('Buttons')).click();14driver.findElement(webdriver.By.name('Rounded')).getAttribute('name').then(function(attrValue) {15 console.log(attrValue);16});17driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id("someId"));2var value = element.getAttribute("value");3var element = driver.findElement(By.id("someId"));4var value = element.getAttribute("text");5var element = driver.findElement(By.id("someId"));6var value = element.getText();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3const browser = await remote({4 capabilities: {5 }6})7const title = await browser.getTitle()8console.log('Title is: ' + title)9await browser.deleteSession()10})().catch((e) => console.error(e))11const { remote } = require('webdriverio');12(async () => {13const browser = await remote({14 capabilities: {15 }16})17const title = await browser.getTitle()18console.log('Title is: ' + title)19await browser.deleteSession()20})().catch((e) => console.error(e))21const { remote } = require('webdriverio');22(async () => {23const browser = await remote({24 capabilities: {25 }26})27const title = await browser.getTitle()28console.log('Title is: ' + title)29await browser.deleteSession()30})().catch((e) => console.error(e))31const { remote } = require('webdriverio');32(async () => {33const browser = await remote({34 capabilities: {35 }36})37const title = await browser.getTitle()38console.log('Title is: ' + title)39await browser.deleteSession()40})().catch((e) => console.error(e))41const { remote } = require('webdriverio');42(async () => {43const browser = await remote({

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));2var attribute = element.getAttribute("name");3console.log(attribute);4var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));5var attribute = element.getAttribute("content-desc");6console.log(attribute);7var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));8var attribute = element.getAttribute("value");9console.log(attribute);10var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));11var attribute = element.getAttribute("name");12console.log(attribute);13var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));14var attribute = element.getAttribute("name");15console.log(attribute);16var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));17var attribute = element.getAttribute("name");18console.log(attribute);19var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));20var attribute = element.getAttribute("name");21console.log(attribute);22var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));23var attribute = element.getAttribute("name");24console.log(attribute);25var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));26var attribute = element.getAttribute("name");27console.log(attribute);28var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));29var attribute = element.getAttribute("name");30console.log(attribute);31var element = driver.findElement(By.id("com.android.calculator2:id/digit_1"));32var attribute = element.getAttribute("name");33console.log(attribute);34var element = driver.findElement(By

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var should = chai.should();7var expect = chai.expect;8var desiredCaps = {9};10var driver = wd.promiseChainRemote('localhost', 4723);11describe('Appium Base Driver', function() {12 this.timeout(300000);13 before(function() {14 .init(desiredCaps)15 .setImplicitWaitTimeout(5000);16 });17 it('should get the value of the attribute "checked" of a checkbox', function() {18 .elementById('com.example.checkbox:id/checkbox')19 .getAttribute('checked')20 .then(function(checked) {21 console.log('checked: ', checked);22 });23 });24 after(function() {25 .quit();26 });27});28getAttribute(attribute)29getAttribute(attribute, callback)30getAttribute(attribute, timeout)31getAttribute(attribute, timeout, callback)32getAttribute(attribute, timeout, pollFreq)33getAttribute(attribute, timeout, pollFreq, callback)34getAttribute(attribute, timeout, pollFreq, callback, asyncResponse)35getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse)36getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse, asyncCb)37getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse, asyncCb, cbArgs)38getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse, asyncCb, cbArgs, asyncArgs)39getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse, asyncCb, cbArgs, asyncArgs, waitForCondition)40getAttribute(attribute, timeout, pollFreq, callback, asyncResponse, cbForResponse, asyncCb, cbArgs, asyncArgs, waitForCondition,

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 Base 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