无法在applitools中拍摄整页截图c#

时间:2017-12-01 01:04:18

标签: c# selenium screenshot applitools

我正在尝试使用此代码拍摄我的页面的全屏截图:

TypeError: _this.form.get is not a function
at forms.js:6831
at Array.forEach (<anonymous>)
at FormGroupDirective._updateDomValue (forms.js:6830)
at FormGroupDirective.ngOnChanges (forms.js:6648)
at checkAndUpdateDirectiveInline (core.js:12092)
at checkAndUpdateNodeInline (core.js:13598)
at checkAndUpdateNode (core.js:13541)
at debugCheckAndUpdateNode (core.js:14413)
at debugCheckDirectivesFn (core.js:14354)
at Object.eval [as updateDirectives] (DatabaseListComponent.html:27)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14339)
at checkAndUpdateView (core.js:13508)
at callViewAction (core.js:13858)
at execComponentViewsAction (core.js:13790)
at checkAndUpdateView (core.js:13514)
at callViewAction (core.js:13858)
at execEmbeddedViewsAction (core.js:13816)
at checkAndUpdateView (core.js:13509)
at callViewAction (core.js:13858)
at execComponentViewsAction (core.js:13790)
at checkAndUpdateView (core.js:13514)
at callWithDebugContext (core.js:14740)
at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.js:14277)
at ViewRef_.detectChanges (core.js:11300)
at core.js:5786
at Array.forEach (<anonymous>)
at ApplicationRef.tick (core.js:5786)
at core.js:5619
at ZoneDelegate.invoke (zone.js:513)
at Object.onInvoke (core.js:4629)
at ZoneDelegate.invoke (zone.js:512)
at Zone.run (zone.js:263)
at NgZone.run (core.js:4446)
at Object.next (core.js:5619)
at SafeSubscriber.schedulerFn [as _next] (core.js:4223)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at EventEmitter.Subject.next (Subject.js:55)
at EventEmitter.emit (core.js:4203)
at checkStable (core.js:4594)
at onLeave (core.js:4673)
at Object.onInvokeTask (core.js:4623)
at ZoneDelegate.invokeTask (zone.js:545)
at Zone.runTask (zone.js:313)
at ZoneTask.invokeTask [as invoke] (zone.js:620)
at invokeTask (zone.js:1661)
at XMLHttpRequest.globalZoneAwareCallback (zone.js:1687)

但我只是得到半页的截图,我试图联系Applitools,但他们只是告诉我将eyes.checkwindow()替换为eyes.Check(“tag”,Target.Window()。完全( ));哪些仍然无效。

如果有人能帮助我那会很棒。

4 个答案:

答案 0 :(得分:1)

我为Applitools工作并为您的烦恼感到抱歉。也许你没有看到我们的回复,或者他们去了你的垃圾邮件文件夹。您需要设置ForceFullPageScreenshot = true和StitchMode = StitchModes.CSS才能捕获整页截图。

以下代码示例是您捕获整页图像所需执行的所有操作。此外,请确保您的.Net Eyes.Sdk版本>&gt; = 2.6.0并且Eyes.Selenium&gt; = 2.5.0。

如果您有任何其他问题或仍然遇到问题,请随时给我发电子邮件。感谢。

var eyes = new Eyes();
eyes.ApiKey = "your-api-key";
eyes.ForceFullPageScreenshot = true;
eyes.StitchMode = StitchModes.CSS;

eyes.Open(driver, "Zinc", testName, new Size(800, 600)); //last parameter is your viewport size IF testing on a browser. Do not set if testing on a mobile devices.
eyes.CheckWindow("Zinc");
//or new Fluet API method
eyes.Check("Zinc", Applitools.Selenium.Target.Window().Fully();
eyes.Close();

答案 1 :(得分:0)

使用范围报告库,您可以获取屏幕截图以及关于通过和失败案例的交互式报告。 这是它如何工作的链接: http://www.softwaretestingmaterial.com/generate-extent-reports/

答案 2 :(得分:0)

如果您想使用Applitools获取完整的页面Screenshot / Special元素。您可以使用以下代码行:-

完整屏幕截图

eyes.setHideScrollbars(false);
eyes.setStitchMode(StitchMode.CSS);
eyes.setForceFullPageScreenshot(true);
eyes.checkWindow();

获取特定元素的屏幕截图

WebElement Button = driver.findElement(By.xpath("//button[@id='login-btn']"));
eyes.setHideScrollbars(false);
eyes.setStitchMode(StitchMode.CSS);     
eyes.open(driver, projectName, testName);
eyes.setMatchLevel(MatchLevel.EXACT);       
eyes.checkElement(Button );

答案 3 :(得分:0)

(我来自Applitools。)

analysis设置为true时,applitools将尝试滚动页面中的calculator元素,如果forcefullpagescreenshoot不是可滚动的元素,则您需要自己进行设置:

HTML

在Firefox中,您可以在可滚动元素附近看到滚动标签。