I am needing to upload a document via Selenium WebDriver using Chromedriver. I have tried all the Action class and Javascript stuff, but those do not work. I am assuming they do not work because those are relying on the button to be an input field, however, the upload button I'm dealing with is not. It's HTML looks like this:
<a id="Dialogs_Dialogs_lbAttachUpload" onclick="return ButtonVerifyEnabled(this, ShowFileSelect);" class="SkinButton sbBlue" onmouseover="ButtonHover(this,30);" onmouseout="ButtonLeave(this);" onmousedown="ButtonDown(this,30);" onmouseup="ButtonHover(this,30);" skinheight="30" style="color: white; width: 132px; height: 30px; line-height: 30px; background-position: 0px 0px;" title=""><div class="SkinButtonLeft" style="background-position: 0px 0px;"></div><div class="SkinButtonRight" style="background-position: -4px 0px;"></div>Upload documents</a>
I have AutoIT and Sikuli implemented and working, but the problem with those solutions is I cannot get them to work when running the Selenium tests via Jenkins.
My latest attempt looks like this:
WebElement upload = SConfirmOrder.uploadDocuments_btn(driver);
Actions actions = new Actions(driver);
actions.moveToElement(upload);
actions.sendKeys("filepath\\Test PDF.pdf");
It runs through successfully, but no document actually gets uploaded.