How to upload a file in Webpage, using Selenium without using other tools.
Let us take application in which you need to click on upload button and then upload a file to web application.
It can be achieved in Selenium using below steps:
1. Find the unique location for "Upload Files" button
2. Use sendKeys on the element by passing full file path.
For eg: driver.findElement(By.xpath("//input[@title='file input']")).sendKeys("C:\\Users\\SrinivasKalmady\\Desktop\\appium error.png");
File will get uploaded:
Youtube channel: https://www.youtube.com/user/srinivaskinik
Facebook page: https://www.facebook.com/srinivaskinikalmady/
Let us take application in which you need to click on upload button and then upload a file to web application.
It can be achieved in Selenium using below steps:
1. Find the unique location for "Upload Files" button
2. Use sendKeys on the element by passing full file path.
For eg: driver.findElement(By.xpath("//input[@title='file input']")).sendKeys("C:\\Users\\SrinivasKalmady\\Desktop\\appium error.png");
File will get uploaded:
Hope this blog has been useful to you.
Youtube channel: https://www.youtube.com/user/srinivaskinik
Facebook page: https://www.facebook.com/srinivaskinikalmady/
No comments:
Post a Comment