2015-02-05 120 views
0

我想編寫一個腳本來填寫表單並上傳黃瓜-js,selenium和量角器中的文件。每當我點擊一個上傳文件按鈕,沒有xpath/id/etc ...點擊。你如何處理文件上傳?如何在cucumber-js中上傳文件

+0

http://stackoverflow.com/questions/21305298/how-to-upload-file-in-angularjs-e2e-protractor-testing/21314337#21314337 – 2015-02-05 21:22:52

回答

0

順便上傳文件與cucumberjs無關。只需發送密鑰輸入type=file。還要確保文件路徑是絕對的。因此,一個純粹的webdriver代碼可以是什麼樣子,

driver.findElement(wd.By.css('input[type=file]')).sendKeys('/absolute/path/to/my/file');