InterviewSolution
Saved Bookmarks
| 1. |
How to upload a file? |
|
Answer» There are two ways you can upload file in selenium WebDriver, one is using SendKey method when there is text box AVAILABLE to enter the file’s name and second is using AutoIT Script tool when there is no text box to enter the file’s name.
Syntax is – //locate browse button WebElement browse =driver.findElement(By.id("id value")); //pass the path of the file to be uploaded using Sendkeys method browse.sendKeys("D:\\SoftwareTestingMaterial\\UploadFile.txt"); //click on submit button driver.findelement(By.id(“id value”)).click;
WinWaitActive("File Upload"); Name of the file upload WINDOW (Windows Popup ame: File Upload) Send("logo.jpg"); File name Send("{ENTER}");
|
|