Skip to content
Browse files

Add RF keyword for taking a screenshot of the entire screen

  • Loading branch information...
1 parent 7a0c149 commit ba07265b1c55dae5684df7c16692cd3f28acab14 @semperos committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/robot_framework_clowd/keywords/native.clj
View
12 src/robot_framework_clowd/keywords/native.clj
@@ -1 +1,11 @@
-(in-ns 'robot-framework-clowd.keywords)
+(in-ns 'robot-framework-clowd.keywords)
+
+(defn capture-screenshot []
+ (let [size (.getScreenSize (Toolkit/getDefaultToolkit))
+ rect (Rectangle. 0 0 (.width size) (.height size))
+ robot (Robot.)
+ img (.createScreenCapture robot rect)
+ path (str (rand-int 100000) "_screenshot.png")
+ file (java.io.File. path)]
+ (do
+ (ImageIO/write img "png" file))))

0 comments on commit ba07265

Please sign in to comment.
Something went wrong with that request. Please try again.