0
私はテキストの色を取得しようとしていると、ページ上のすべてのp要素の背景色を取得:PhantomJS - 要素計算スタイル
elements = document.querySelectorAll("p");
console.log("elements " + elements.length);
console.log(window.getComputedStyle(elements[0]));
console.log(window.getComputedStyle(elements[0]).length);
console.log(window.getComputedStyle(elements[0]).getPropertyValue("background-color"));
console.log(window.getComputedStyle(elements[0]).getPropertyValue("color"));
console.log(elements[0].innerHTML);
この版画:
background-color: rgba(0, 0, 0, 0)
color: rgb(225, 224, 220)
しかし、もしを私はクロムに行き、最初のp要素の計算されたスタイルをチェックします:
background-color: #43413e (67, 65, 62 as rgb)
color: #e1e0dc (225, 224, 220 as rgb)
これは私に "計算された"タイル、なぜそれをやっていないのですか?私はここで何が欠けていますか?それは印刷する必要がありますbrackground-color: rgb(67, 65, 62)