java - Uploading file using selenium javascript error -
i have browse button browse file. after browsing there import button import file. i'm able browse path using following code:
public static void uploadfiles(string object, string data) { try { string filemode=""; capabilities cap = ((remotewebdriver) driver).getcapabilities(); string browsername = cap.getbrowsername(); //system.out.println(browsername); if (browsername.contains("chrome")){ filemode= "open"; } else if (browsername.contains("firefox")){ filemode= "file upload"; } else if (browsername.contains("explorer")){ filemode = "choose file upload"; } string exe_file=driverscript.exe_filename; string[] command={exe_file,filemode,data}; runtime.getruntime().exec(command); thread.sleep(5000); } catch (exception e) { } }
but when click on import button after "javascript error (warning: server did not provide stacktrace information)" exception thrown. exe_file path fileload.exe used browsing
uploading file using selenium:
webelement upload = driver.findelement(by.id("identifier of input tag")); upload.sendkeys("path file");
Comments
Post a Comment