Image upload with selenium webdriver not working - selenium-webdriver

I am not able to automate image upload with selenium webdriver.
I have tried with AutoIT and Robot class as well , But its not working.
I have also tried with different options suggested on stackoverflow but not working for me...
driver.findElement(By.xpath("//*[#id=\"addSampleImg\"]")).sendKeys("D:\\Test11");
Any other option to resolve?

You should have to include the file name as an argument in sendKeys().
driver.findElement(By.xpath("//*[#id=\"addSampleImg\"]")).sendKeys("D:\Test11\Your file name with extension")
For ex.
driver.findElement(By.xpath("//*[#id=\"addSampleImg\"]")).sendKeys("D:\Test11\Sample.jpeg");
Hope it will work then.

Related

Image upload functionality- xpath issues

We have a upload functionality where we can upload .csv files and I am trying to automate this using selenium webdriver.
Here is the xpaths i have used,but none of them are working.
//span[contains(text(),'click here to browse')]
//input[#type='file']
Any suggestions for this type of functionality
Below is the UI

Can we verify image dimension in a PDF by Selenium webdriver?

I have a requirement to verify the image dimension of a PDF, which is getting downloaded and saved to a particular location. I am curious to know that, is there any way we can check the image dimension of a PDF using Selenium WebDriver? Please help.
Selenium WebDriver is for browser automation. If your requirement is to validate pdf files, contents, images in the pdfs etc, I would suggest you to use the below pdf library.
http://www.testautomationguru.com/introducing-pdfutil-to-compare-pdf-files-extract-resources/

Edge Upload File control using Selenium

I am trying to upload a file using Selenium Webdriver on the Edge browser, and yes I have downloaded EdgeDriver and installed the MSI for testing Edge. Clicking on elements on the screen from within the Edge browser works fine. The problem is the upload file control. My code is as follows:
IWebElement fileUploader2 = Browser.Driver.FindElements(By.CssSelector("input[type='file']"))[0];
fileUploader2.SendKeys(FileUtility.FileUploadsDirectory + "\\sample-account_balances.xlsx");
The code above works for Chrome and Firefox, but does not work for Edge. This is a ReactJS web app. I have tried the suggestions below that are similar to my code above and I cannot seem to upload a file using the control programmatically from Selenium Webdriver. There is no error given it just does not click on send text to the file upload control. Nothing is executed:
How to upload file using Selenium Webdriver?
File Control on Edge
DOM Upload Control Edge
Unfortunately this feature has not been added to the edge webdriver yet. I've run into the same problem and have not been able to find a suitable solution yet. One (admitedly not ideal) solution is to use AutoIt to automate the file upload for edge. There are multiple reports of this issue, but here's one of the latest reports showing that its an issue with the edge driver.

Uploading file in selenium webdriver to html label (mac)

I'm trying to automate an image upload using selenium webdriver with java. The problem is that rather than the html element of the link to upload being an
, it's a label: (without the spaces in tags so it shows)
< label class="btn btn-default btn-icon btn-blue custom-file-upload ng-binding" for="logo">Select file< /label>
This prevents me from using sendKeys with the absolute path which is usually the simplest method:
#FindBy(xpath="//label[#for='imageUpload']") private WebElement imageUploadLabel;
imageUploadLabel.sendKeys("AbsolutePathHere");
I've tried using robot/action class as well as there are many examples on these forums of that but as soon as the browse file upload window pops up it effectively kills my script. I know the best way to do this would be just to change the html element in the source code but that is not an option, so I'm looking for another way to possibly do it.
I'm using a mac as well so autoit is not an option. I've looked extensively on these forums and others trying to find an alternative but every option I've encountered either uses an input file html element or does not work for me. Let me know if more information is needed. Any ideas would be greatly appreciated. Thanks in advance!

Wijmo and Dotnetnuke 7. Has anyone tried it? Not working

Has anyone tried using the wijmo widgets in DNN 7.+ ?
For my example I'm trying to use the upload widget.
If I upload to a path on my server and test, it works (As in the dialog appears to choose a file... the popup)
If I load it within a page on the site, the button shows but nothing happens when clicked.
All script files and necessary markup are correct.
No console erros, nothing. Very confusing.
Wijmo widgets work in DNN 7.+.
The “action” option should be changed to the server’s address of upload.ashx file.
Note: the upload sample can’t be opened by file path(d:/……/upload.html), please make sure it is opened on server.
Thanks,
Richa

Resources