-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0f57dc
commit e02d384
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.ea.springbasic.util; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.openqa.selenium.OutputType; | ||
import org.openqa.selenium.TakesScreenshot; | ||
import org.openqa.selenium.WebDriver; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.util.UUID; | ||
|
||
@Component | ||
public class ScreenShotUtil { | ||
|
||
@Autowired | ||
protected WebDriver webDriver; | ||
|
||
@Value("${screenshot.path}") | ||
private Path screenshotPath; | ||
|
||
public void takeScreenShot() { | ||
File screenshot = ((TakesScreenshot) this.webDriver).getScreenshotAs(OutputType.FILE); | ||
try { | ||
FileUtils.copyFile(screenshot, new File( | ||
screenshotPath.toString() + "\\" + UUID.randomUUID() + ".png")); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
System.out.println("Take screenshot"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
app.url=http://eaapp.somee.com | ||
env=prod | ||
browser=chrome | ||
screenshot.path=target/screenshots | ||
#driver.options= |