Home >Java >javaTutorial >How to Upload Files Using Selenium WebDriver in Java When the Browse Button is a Silverlight Control?
Uploading Files with Selenium WebDriver in Java
Uploading files is a common task in web applications. In this article, we'll discuss how to upload files using Selenium WebDriver in Java, addressing a specific scenario where the browse button is developed using Silverlight (C#).
Problem:
I want to upload a file using Selenium, but the browse button opens a new window that can't be directly interacted with by Selenium.
Solution:
As suggested by Mark Collin, instead of clicking on the browse button, we can use the following code:
driver.findElement(By.id("myUploadElement")).sendKeys("<absolutePathToMyFile>");
where:
Key Points:
Additional Tips:
The above is the detailed content of How to Upload Files Using Selenium WebDriver in Java When the Browse Button is a Silverlight Control?. For more information, please follow other related articles on the PHP Chinese website!