robotframework - Robot Framework and Java - Upload file from project directory -


im trying upload file projects root folder using robot framework , java. when popup window opens, root file path sent popup popup never closes submit file. if change file path desktop popup opens desktop file path submitted , popup closes submitting file.

heres robot class

package utils;  import static java.awt.event.keyevent.*; import java.awt.awtexception; import java.awt.robot; import java.awt.event.keyevent;  public class robotwrite {      private robot robot;      public robotwrite() throws awtexception {         this.robot = new robot();     }        public void type(charsequence characters) throws awtexception {         int length = characters.length();         (int = 0; < length; i++) {             char character = characters.charat(i);             type(character);         }     }      public void type(char character) throws awtexception {         switch (character) {         case 'a': dotype(vk_a); break;         case 'b': dotype(vk_b); break;         .........         .........         case '?': dotype(vk_shift, vk_slash); break;         case ' ': dotype(vk_space); break;         default:             throw new illegalargumentexception("cannot type character " + character);         }     }      private void dotype(int... keycodes) {         dotype(keycodes, 0, keycodes.length);     }      private void dotype(int[] keycodes, int offset, int length) {         if (length == 0) {             return;         }          robot.keypress(keycodes[offset]);         dotype(keycodes, offset + 1, length - 1);         robot.keyrelease(keycodes[offset]);     }  } 

and calling method set path..

public static void robotwrite() throws exception{             try{                  robotwrite rw = new robotwrite();                                rw.type("c:\\workspace\\project\\src\\main\\resources\\data\\examplecv.docx"); //doesnt work                    //rw.type("c:\\users\\desktop\\examplecv.docx"); //works                     robot r = new robot();                    r.keypress(vk_enter);                    r.keyrelease(vk_enter);              }catch (exception e){                  log.error("could not write");                 throw(e);                 }             } 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -