| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // dom_automation.js | 5 // dom_automation.js |
| 6 // Methods for performing common DOM operations. Used in Chrome testing | 6 // Methods for performing common DOM operations. Used in Chrome testing |
| 7 // involving the DomAutomationController. | 7 // involving the DomAutomationController. |
| 8 | 8 |
| 9 var domAutomation = domAutomation || {}; | 9 var domAutomation = domAutomation || {}; |
| 10 | 10 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 domAutomation.getAttribute = function(element, attribute) { | 387 domAutomation.getAttribute = function(element, attribute) { |
| 388 return element.getAttribute(attribute); | 388 return element.getAttribute(attribute); |
| 389 } | 389 } |
| 390 | 390 |
| 391 domAutomation.getValue = function(element, type) { | 391 domAutomation.getValue = function(element, type) { |
| 392 if (type == "text") { | 392 if (type == "text") { |
| 393 return getText(element); | 393 return getText(element); |
| 394 } else if (type == "innerhtml") { | 394 } else if (type == "innerhtml") { |
| 395 return trim(element.innerHTML); | 395 return trim(element.innerHTML); |
| 396 } else if (type == "innertext") { |
| 397 return trim(element.innerText); |
| 396 } else if (type == "visibility") { | 398 } else if (type == "visibility") { |
| 397 return isVisible(element); | 399 return isVisible(element); |
| 398 } else if (type == "id") { | 400 } else if (type == "id") { |
| 399 return element.id; | 401 return element.id; |
| 400 } else if (type == "contentdocument") { | 402 } else if (type == "contentdocument") { |
| 401 return element.contentDocument; | 403 return element.contentDocument; |
| 402 } | 404 } |
| 403 } | 405 } |
| 404 | 406 |
| 405 domAutomation.waitForAttribute = function(element, attribute, value, callId) { | 407 domAutomation.waitForAttribute = function(element, attribute, value, callId) { |
| 406 (function waitForAttributeHelper() { | 408 (function waitForAttributeHelper() { |
| 407 try { | 409 try { |
| 408 if (element.getAttribute(attribute) == value) | 410 if (element.getAttribute(attribute) == value) |
| 409 onAsyncJavaScriptComplete(callId); | 411 onAsyncJavaScriptComplete(callId); |
| 410 else if (!didCallFinish(callId)) | 412 else if (!didCallFinish(callId)) |
| 411 window.setTimeout(waitForAttributeHelper, 200); | 413 window.setTimeout(waitForAttributeHelper, 200); |
| 412 } | 414 } |
| 413 catch (exception) { | 415 catch (exception) { |
| 414 onAsyncJavaScriptError(callId, exception); | 416 onAsyncJavaScriptError(callId, exception); |
| 415 } | 417 } |
| 416 })(); | 418 })(); |
| 417 } | 419 } |
| 418 })(); | 420 })(); |
| OLD | NEW |