如何在codeceptjs /量角器中使用I.attachFile?

时间:2018-04-27 07:42:56

标签: selenium automated-tests codeceptjs

I.attachFile('input[type=file]', 'test.txt');

我在codeceptjs / protractor中尝试了attachFile函数。我收到了这个错误。

  

TypeError:driver.execute不是函数

chromeDriver:2.33
selenium-standalone:3.7.1
codeceptJS:1.0.3

"output": "./e2e/codeceptjs_tests/reports",
"helpers": {
  "Protractor": {
    "url": "http://localhost:4200/",
    "driver": "hosted",
    "browser": "chrome",
    "rootElement": "body",
    "smartWait":5000, 

Error Pic

Code Scope

2 个答案:

答案 0 :(得分:0)

尝试使用 var rootRef = firebase.database().ref('Admin').child('AssignCarTowing'); rootRef.on("child_added", function (snapshot) { snapshot.forEach(function (snap) { //console.log(snapshot.key); //console.log(snap.key); var status = snap.child("Status").val(); var name = snap.child("Name").val(); var cnum = snap.child("CarNumber").val(); var cmodel = snap.child("CarModel").val(); var hp = snap.child("ContactNo").val(); var brkloc = snap.child("BreakdownLocation").val(); var dandt = snap.child("TowingDateandTime").val(); var peric = snap.child("PersonInCharge").val(); $("#towreqlist").append("<tr><td>" + status + "</td><td>" + name + "</td><td>" + cmodel + "</td><td>" + cnum + "</td><td>" + dandt + "</td><td>" + hp + "</td><td>" + brkloc + "</td><td>" + peric + "</td><td><button onclick='done(\"" + snapshot.key + "\", \"" + snap.key + "\")' class='btn btn-success btn-sm'>Done</button>"); }); });

答案 1 :(得分:0)

语法正确,但是您必须在第一个参数而不是字段中选择按钮

I.attachFile('button','test.txt')