Skip to content

Commit

Permalink
Merge pull request #1275 from babusekaran/w3c/print
Browse files Browse the repository at this point in the history
implemented https://w3c.github.io/webdriver/#print currently supporte…
  • Loading branch information
ptrthomas authored Aug 31, 2020
2 parents c57a255 + dde4073 commit cd60618
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ public String getDialog() {
return currentDialogText;
}

@Override
public byte[] pdf(Map<String, Object> options) {
DevToolsMessage dtm = method("Page.printToPDF").params(options).send();
String temp = dtm.getResult("data").getAsString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ default List scriptAll(String locator, String expression, Predicate predicate) {
return after;
}

@AutoDef
public byte[] pdf(Map<String, Object> options);

// for internal use ========================================================
//
boolean isTerminated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,4 +588,11 @@ public void switchFrame(String locator) {
protected Base64.Decoder getDecoder() {
return Base64.getDecoder();
}

@Override
public byte[] pdf(Map<String, Object> printOptions){
String temp = http.path("print").post(printOptions).jsonPath("$.value").asString();
return Base64.getDecoder().decode(temp);
}

}

0 comments on commit cd60618

Please sign in to comment.