本文介绍了Selenium禁用位置固定内容在删除整个页面时删除重复数据屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我可以通过滚动到window.innerheight来拍摄整个页面的屏幕截图,但同时结合面对重复的问题(位置固定的标题/内容) em>是他们的任何解决方案来解决这个问题。请清楚回复您的回答。



FireFox 打开

使用 selenium与 (取消选中安全和隐私复选框并减少互联网,接受所有Cookie为零)。
使用 ieCapabilities.setCapability(ignoreZoomSetting,true);
然后它通过减少客户端宽度与任何图像像素问题。但在本网站上的屏幕截图: http://help.dottoro.com/ljlumkqh.php 不是预期的。



但在 Chrome 中,只需。为了采取
整页屏幕截图,我们需要滚动到clientHeight并组合所有
屏幕截图。

解决方案

删除粘滞数据



窗口。方法及其



for IE before version 9

  var elems = window.document.getElementsByTagName('*'); 
for(i = 0; i if(window.getComputedStyle){
var elemStyle = window.getComputedStyle(elems [i],null);
if(elemStyle.getPropertyValue('position')=='fixed'& elems [i] .innerHTML.length!= 0){
elems [i] .parentNode.removeChild [一世]);
}
alert(适用于所有浏览器);
} else {
var elemStyle = elems [i] .currentStyle;
if(elemStyle.position =='fixed'& elems [i] .childNodes.length!= 0){
elems [i] .parentNode.removeChild(elems [i]);
}
alert(适用于IE浏览器版本9以下);
}
}


I am able to take screen shots of entire page by scrolling to window.innerheight but while combining facing proble of duplicate(position fixed Header/content) in all the pages.Is their any solution to resolve this problem. please post your answer clearly.

FireFox open Developer Toolbar and hit shift + f2 then type this command.
screenshot d:\yash.png --fullpageThen it reduces the clientWidth and takes screenshot.Selenium-WebDriver FireFox-ScreenShot

Using selenium with IE(uncheck checkboxes of security & privacy and reduce Internet, Accept all cookies to zero).use ieCapabilities.setCapability("ignoreZoomSetting", true);then it takes screenshot of entire page by reducing the client width with out any Image pixel problem. but the Screen shot on this Site:http://help.dottoro.com/ljlumkqh.php is not as expected.

But in Chrome it takes only visible part of web page. In order to takewhole page screen shot we need to scroll to clientHeight and combine allscreen shots.

解决方案

Remove Sticky Data

Window.getComputedStyle() method and its supported Browsers.

currentStyle object for IE before version 9

var elems = window.document.getElementsByTagName('*');
for(i = 0; i < elems.length; i++) {
        if (window.getComputedStyle) {
             var elemStyle = window.getComputedStyle(elems[i], null);
             if(elemStyle.getPropertyValue('position') == 'fixed' && elems[i].innerHTML.length != 0 ){
                 elems[i].parentNode.removeChild(elems[i]);
             }
        alert (Works For all Browsers);
        }else {
             var elemStyle = elems[i].currentStyle;
             if(elemStyle.position == 'fixed' && elems[i].childNodes.length != 0 ){
                 elems[i].parentNode.removeChild(elems[i]);
             }
        alert (Works for IE browsers version below 9);
        }
}

这篇关于Selenium禁用位置固定内容在删除整个页面时删除重复数据屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 13:12