0

Scenario: In my application there is file browser button. Clicking this browser the file selection windows opens. From there we select our required file and click on upload.

Problem: When we are doing this on Firefox and Chrome, there is no problem. But when we are doing this through IE11 that time the file browser button is being clicked by the script, but the file selection window is not poping up. I have checked the same manually on IE11, that time no problem is happening. But script opened is not responding on that specific button. For ex- Through script I launched the IE and paused the script. If I am trying to click the file browser option manually on the same browser now, it would not respond with the file selection dialog window. But at the same time if I open a new browser manually and try clicking that browser option manually, then it would work.

Web Code:

There is a <iframe> object appears. Within this iframe the whole html page loads and under some nested <div> container this file browser option resides under <input id="UploadFile" class=*** type=*** ..> like wise.

Selenium Code:

WebElement ImportDef = driver.findElement(By.id("UploadFile"));
Thread.sleep(3000);
ImportDef.click();
OarpitO
  • 357
  • 1
  • 10
RCode
  • 99
  • 2
  • 2
  • 13
  • instead of `.click()` you can set file path using `sendKeys()` as `ImportDef.sendKeys("file/to/upload")`.. – Saurabh Gaur Aug 24 '16 at 11:34
  • This click is for clicking the file browse button on the webpage. If the file selection dialog doesn't popup, how can I upload /set path for a file?? My prob is not about uploading the file. My problem is that the file selection dialog is not appearing on the active screen when we are executing on IE11 – RCode Aug 24 '16 at 11:45
  • Have a look here http://stackoverflow.com/questions/5610256/file-upload-using-selenium-webdriver-and-java – Saurabh Gaur Aug 24 '16 at 11:48
  • You should not handle upload button, but input field instead – Andersson Aug 24 '16 at 11:48
  • @SaurabhGaur: I have seen the above link. They looks like similar but not. First:In that problem it was not working on both Firefox and IE11, for me it isnot working only for IE. Second: In that problem after clicking browse option the selection window was at least opening, for me it is not. Still I would like to try that one. Lets see – RCode Aug 24 '16 at 11:52
  • Ok means your problem is why is upload window not open. Rigth?? – Saurabh Gaur Aug 24 '16 at 11:55
  • @SaurabhGaur: Yes, you are correct. That is also for IE11 – RCode Aug 24 '16 at 11:56
  • So when are you going to click there is any exception?? – Saurabh Gaur Aug 24 '16 at 11:57
  • @Andersson: There is no such input field. When I click the browser option, it directly opens the file selection window. This is the scenario. – RCode Aug 24 '16 at 11:57
  • @SaurabhGaur :No. No such exception is there. Because actually the script keeps waiting to pop up the file selection window. After a certain time of waiting it gets time out. – RCode Aug 24 '16 at 12:00
  • Could you share your website URL?? – Saurabh Gaur Aug 24 '16 at 12:01
  • Sorry, I am unable to do so. As it is copy right content, you need credentials to access.Also, I am not authorize to share any internal code. I know sharing the code could be more easy for you all, bt not possible. – RCode Aug 24 '16 at 12:05
  • @RoyCode, `` this is the target input field. You should send local path to file as string to this input element – Andersson Aug 24 '16 at 12:48
  • @Andersson: Understood your point.Let me try and share the outcome – RCode Aug 29 '16 at 12:19

0 Answers0