Image upload functionality- xpath issues - selenium-webdriver

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

Related

Grab and save SVG File using selenium - C# Selenium chromedriver WinForm

I am writing WhatsApp tool in C# winform using Selenium ChromeDriver.
I have handled all operations like sending the message, clicking the attachment and all from WhatsApp web using Selenium ChromeDriver.
I want to read the WhatsApp web's QR Code which is in SVG format. I want to read the SVG File and convert and save as image in local.
I could save the QR Code using snapshot, but I don't prefer using this because I have to maintain vertical scroll position to bring full QR Code on screen.
So please help me save svg file image using chromedriver
Thank you.
-Ishrar
I'm not sure of the specific commands in Selenium, but can't you just:
copy the SVG code via Javascript/a Selenium method
then create a new .svg file in Java and save this copied svg code as the contents?

Is there any other way to upload file in web page without using AutoIt in webdriver framework

We are looking for a way to upload images/files in webpage where our automation framework is Selenium Web driver [Robot framework] and we are using AutoIt to do the same.
When we are using auto-it we are kept on observing corrupted issues. Looking for some one's support to overcome this,
You can use the keyword Choose File for File uploading in Robot Framework.
Syntax:
Choose File locator file_path
Example:
Choose File my_upload_field ${CURDIR}/trades.csv
For more details you can use this link

Image upload with selenium webdriver not working

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.

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.

Resources