1

I'm having a problem managing File upload in Selenium using Chromedriver and C#. I read a couple of answers to similiar problems regarding the file uploader dialogue window and how this can be solved. The thing is that I don't have the standard input element but instead, I have this:

<div class="scUploadWrapper">
    <div id="Overlay2" class="scUploadOverlay" style="width: 80px; height: 59px;">
        <embed id="yuigen1" type="application/x-shockwave-flash" src="..." style="undefined" name="yuigen1" bgcolor="#ffffff" quality="high" allowscriptaccess="always" wmode="transparent" menu="false" flashvars="allowedDomain=domain.com&elementID=yuigen1&eventHandler=YAHOO.widget.FlashAdapter.eventHandler" tabindex="1" width="100%" height="100%"/>
    </div>
    <a class="scOption" href="#" onclick="javascript:scForm.invoke('media:multiupload(load=1, ownframe=1)');return false">
        <img class="scIcon" src="/temp/IconCache/Applications/32x32/export1.png" alt="" width="32" border="0" height="32"/>
        <div class="scHeader">Upload Files</div>
    </a>
</div>

The thing is that this workaround

linkUploadFiles.WaitTillVisible(); linkUploadFiles.SendText(@"C:\Users\folder\image.PNG");

is therefore not usable. Any ideas what to do with it? I'm kinda stuck. Thanks a lot.

Hoverlord
  • 21
  • 6
  • So this is a flash file upload control? Can you execute javascript on the page to interact with it like so https://stackoverflow.com/questions/6229769/execute-javascript-using-selenium-webdriver-in-c-sharp#answer-6285793 ? – Dan Csharpster Jun 22 '17 at 22:09

1 Answers1

0

Selenium can not handle windows based dialogues. Instead use Auto IT scripts.
The example script is below.
Modify the script based on the properties of your windows dialogue:

Local $hWnd = WinWait("[CLASS:#32770]", "", 120)
ControlClick($hWnd,"","[CLASS:Edit; INSTANCE:1]")
Send($pathofFile)
Send("{ENTER}")
Exit
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68