jeudi 16 juillet 2015

How to handle file upload in selenium webdriver

I have a HTML code with button name Upload & id as 'btn-import-questions'

<button class="btn btn-success btn-sm col-lg-11" id="btn-import-questions" data-ts-file-selector="questions-import-init">  Upload&nbsp;<i class="fa fa-upload"></i></button>


I tried a selenium code like this ,
driver.findElement(By.id("btn-import-questions")).sendkeys("C:/path/to/file.xlsx");

But since upload is a button not an input-type, the above code is not working

Aucun commentaire:

Enregistrer un commentaire