我需要下载一个文件xml但是在下载的那一刻我得到了警告信息"这种类型的文件可能会损害你的计算机(chrome)"
module.exports = {
"download" : function (browser) {
browser
.waitForElementVisible('body',1000)
.setValue('input[type=text]', 'user')
.setValue('input[type=password]', 'password')
.click('input[type=submit]') //inicia sesion
.waitForElementVisible('body',1000)
.click('[value=RdoTipoBus]') //selecciona radio
.click('input[type=submit]')
.waitForElementVisible('body',1000)
.pause(1000)
.moveToElement('[value=RdoFechas]',10,10)
.mouseButtonClick(1)
.pause(1000)
.click('div[style="width: 55px;"]')
.waitForElementVisible('a[href="#5"]',1000)
.click('a[href="#5"]')
.click('input[type=submit]')
.pause(3000)
.waitForElementVisible('#masivapg0', 50000 , function(){
.click("#masivapg0 > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child("+ i +") > td:nth-child(1) > div:nth-child(1) > img:nth-child(4)")
/////button download file//
})
}
};
答案 0 :(得分:0)
查看https://github.com/nightwatchjs/nightwatch/wiki/Chrome-Setup#command-line-switches和http://peter.sh/experiments/chromium-command-line-switches/#safebrowsing-disable-download-protection
有一个选项可以使用chromedriver
禁用警告,因此在desiredcapabilities
对象中您需要类似
"desiredCapabilities" : {
"browserName" : "chrome",
"javascriptEnabled" : true,
"acceptSslCerts" : true,
"chromeOptions" : {
"args" : ["safebrowsing-disable-download-protection"]
}
}
请注意我还没有测试过这个,但我希望它有所帮助。