Second File uploading window is not closing using selenium webdriver? -
here code used uploading image via uploading window. on site there 5 uploading button, here try upload 2 images 2 browse buttons. problem that, first window image upload , window closed, second uploading window image url copied uploading window not close.
first window code:
driver.findelement(by.xpath("//li[@id='upload_1']/input")).click(); stringselection ss = new stringselection("d:\\cars\\audi.jpg"); toolkit.getdefaulttoolkit().getsystemclipboard().setcontents(ss, null); robot robot = new robot(); robot.keypress(keyevent.vk_enter); robot.keyrelease(keyevent.vk_enter); robot.keypress(keyevent.vk_control); robot.keypress(keyevent.vk_v); robot.keyrelease(keyevent.vk_v); robot.keyrelease(keyevent.vk_control); robot.keypress(keyevent.vk_enter); robot.keyrelease(keyevent.vk_enter);
second window code:
driver.findelement(by.xpath("//li[@id='upload_2']/input")).click(); stringselection ss1 = new stringselection("c:\\cars\\audilights.jpg"); toolkit.getdefaulttoolkit().getsystemclipboard().setcontents(ss1, null); robot robot1 = new robot(); robot1.keypress(keyevent.vk_enter); robot1.keyrelease(keyevent.vk_enter); robot1.keypress(keyevent.vk_control); robot1.keypress(keyevent.vk_v); robot1.keyrelease(keyevent.vk_v); robot1.keyrelease(keyevent.vk_control); robot1.keypress(keyevent.vk_enter); robot1.keyrelease(keyevent.vk_enter);
yes browse window/uploading window closing adding sleep of 3-4 second before last enter key pressed. thank subh all:)
Comments
Post a Comment