@@ -75,8 +75,8 @@ private void loadJSHelperFiles() throws IOException {
7575 * @param url
7676 * @return Javascript string
7777 */
78- private String getDownloadJsCallScript (URL url ) {
79- return ";return seleniumDownloadHelper.getB64Binary('" + url + "');" ;
78+ private String getDownloadJsCallScript (URL url , String method , String param ) {
79+ return ";return seleniumDownloadHelper.getB64Binary('" + url + "','" + method + "','" + param + "' );" ;
8080 }
8181
8282 /**
@@ -87,14 +87,27 @@ private String getDownloadJsCallScript(URL url) {
8787 * @return raw data
8888 */
8989 public FileData getFileFromUrlRaw (URL url ) {
90+ return getFileFromUrlRaw (url , "GET" , "null" );
91+ }
92+
93+ /**
94+ * Executes XHR request trough JavaScript to download the given file in the context of the current WebDriver
95+ * session.
96+ *
97+ * @param url
98+ * @param method POST or GET
99+ * @param param Parameters for the Post Request
100+ * @return raw data
101+ */
102+ public FileData getFileFromUrlRaw (URL url , String method , String param ) {
90103 String scriptCollection ;
91104 if (js instanceof InternetExplorerDriver ) {
92- scriptCollection = ieHackTestJs + ieHackJs + base64Js + dlHelperJs + getDownloadJsCallScript (url );
105+ scriptCollection = ieHackTestJs + ieHackJs + base64Js + dlHelperJs + getDownloadJsCallScript (url , method , param );
93106 } else if (js instanceof HtmlUnitDriver ) {
94107 //throw new BrowserNotSupportedException("JS download hack is not working on HTMLUnit");
95- scriptCollection = skipIeHackTestJS + base64Js + dlHelperJs + getDownloadJsCallScript (url );
108+ scriptCollection = skipIeHackTestJS + base64Js + dlHelperJs + getDownloadJsCallScript (url , method , param );
96109 } else {
97- scriptCollection = ieHackTestJs + base64Js + dlHelperJs + getDownloadJsCallScript (url );
110+ scriptCollection = ieHackTestJs + base64Js + dlHelperJs + getDownloadJsCallScript (url , method , param );
98111 }
99112 String jsRetVal = (String ) js .executeScript (scriptCollection );
100113 String [] jsRetArr = jsRetVal .split (":contentstarts:" , 2 );
0 commit comments