Selenium with C# 60 - File Uploading in Chrome & Firefox using IWebElement SendKeys method

Опубликовано: 04 Октябрь 2024
на канале: Ankpro Training
6,821
45

File Uploading in Chrome & Firefox using IWebElement SendKeys method
#selenium #fileupload #csharpselenium #seleniumcsharp

Analyzing file upload control
Uploading the file in Chrome and Firefox

Possible Interview Questions on selenium file upload.
How to upload a file in Chrome browser?
How to upload a file in Firefox browser?


Code for selenium c# file upload
[TestMethod]
public void FileUpload()
{
IWebDriver driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
driver.Url = "http://uitestpractice.com/Students/Wi...";

driver.FindElement(By.Id("image_file")).SendKeys(@"C:\Users\ANKIT\Desktop\youtube-subscribe-button-transparent-background-hd-png-download.png");

Thread.Sleep(4000);
driver.Quit();
}