-4

I want to upload a file with selenium webdriver. The file is in resources folder of my project, how can i do ?

2

1 Answer 1

-1

easy way is simple case of just finding the element and typing the absolute path of the document into it.

HTML code should look similar to this :

<input type="file" name="datafile">

Syntax:

//Find the element of upload button and send the path
WebElement element= driver.findElement(By.name("datafile"));
element.sendKeys("C:\Users\Easy\Desktop\testfile.txt");
Sign up to request clarification or add additional context in comments.

1 Comment

i'm not using '<input>' in my HTML code '<a class="tft-btn ng-binding" ng-bind="config.messages.buttonUploadTitle" ng-click="executeUploadAction()" href="">Télécharger votre modèle</a>'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.