Sha256: 2a06d6b8a7507e2d409de6461b65d7ee3e550e3cbd580fd71f7bdda4b2fca252

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

(function () {
  const observer = new MutationObserver((mutations) => {
    for (const mutation of mutations) {
      switch (mutation.type) {
        case 'attributes':
          // Don't report our own attribute has changed.
          if (mutation.attributeName === "data-__webdriver_id") {
            break;
          }
          const curr = mutation.target.getAttribute(mutation.attributeName);
          var id = mutation.target.dataset.__webdriver_id
          if (!id) {
            id = Math.random().toString(36).substring(2) + Date.now().toString(36);
            mutation.target.dataset.__webdriver_id = id;
          }
          const json = JSON.stringify({
            'target': id,
            'name': mutation.attributeName,
            'value': curr,
            'oldValue': mutation.oldValue
          });
          __webdriver_attribute(json);
          break;
        default:
          break;
      }
    }
  });

  observer.observe(document, {
    'attributes': true,
    'attributeOldValue': true,
    'characterData': true,
    'characterDataOldValue': true,
    'childList': true,
    'subtree': true
  });
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
selenium-webdriver-4.0.0.beta1 lib/selenium/webdriver/atoms/mutationListener.js
selenium-webdriver-4.0.0.alpha7 lib/selenium/webdriver/atoms/mutationListener.js