forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTS_Capture.cs
More file actions
35 lines (28 loc) · 1.02 KB
/
TS_Capture.cs
File metadata and controls
35 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.IO;
using Selenium.Tests.Internals;
using A = NUnit.Framework.Assert;
using TestCase = NUnit.Framework.TestCaseAttribute;
using TestFixture = NUnit.Framework.TestFixtureAttribute;
namespace Selenium.Tests {
[TestFixture(Browser.Firefox)]
[TestFixture(Browser.Opera)]
[TestFixture(Browser.Chrome)]
[TestFixture(Browser.IE)]
[TestFixture(Browser.PhantomJS)]
class TS_Capture : BaseBrowsers {
public TS_Capture(Browser browser)
: base(browser) { }
[TestCase]
public void ShouldCaptureToFile() {
driver.Get("/elements.html");
var imgname = string.Format("wd-capt-{0}-{1}.png"
, Fixture.ToString().ToLower()
, DateTime.Now.Ticks.ToString());
driver.TakeScreenshot().SaveAs(@"%temp%\" + imgname);
var file = new FileInfo(Environment.ExpandEnvironmentVariables(@"%temp%\" + imgname));
A.Greater(file.Length, 10000);
file.Delete();
}
}
}