小编use*_*213的帖子

自定义混合任务无法找到"任务"

我有一个任务在lib/mix/tasks/thing.exs

代码是:

defmodule Mix.Tasks.Thing do
  use Mix.Task

  def run(_) do
    IO.puts "hello world"
  end

end
Run Code Online (Sandbox Code Playgroud)

当我跑步mix thingmix Thing我得到The task thing could not be foundThe task Thing could not be found

mix compile事先尝试过跑步,但没有帮助.

我也尝试将这个问题的代码直接放到我的mix.exs中,如该问题所示.我仍然无法执行任务.

elixir-mix elixir

7
推荐指数
1
解决办法
1720
查看次数

使用量角器和selenium将文件上传到隐藏输入

我有一个隐藏的文件输入字段,如下所示:

<input type="file" id="fileToUpload-1827" multiple="" onchange="angular.element(this).scope().setFiles(this)" data-upload-id="1827" class="hidden-uploader">
Run Code Online (Sandbox Code Playgroud)

我希望能够将文件上传到此.在量角器中执行此操作的常规方法是:

ptor.findElement(protractor.By.css('.file-upload-form input')).sendKeys('/path/to/file')
Run Code Online (Sandbox Code Playgroud)

但由于输入元素不可见,我收到错误.

我试过了:

  ptor.driver.executeScript("return $('.file-upload-form input')[0].removeClass('hidden-uploader');").then(function () {
    ptor.findElement(protractor.By.css('.file-upload-form input')).sendKeys('hello');
  })
Run Code Online (Sandbox Code Playgroud)

但得到了错误

UnknownError: $(...)[0].removeClass is not a function
Run Code Online (Sandbox Code Playgroud)

使用executeScript一个元素可见以便我可以上传文件似乎很荒谬,有更好的方法吗?如果没有,我该如何取消隐藏元素?

输入表单的完整html是:

<form class="file-upload-form ng-scope ng-pristine ng-valid" ng-if="ajaxUploadSupported">
<strong>Drag files here to upload</strong> or

<label for="fileToUpload-1953">
  <div class="btn btn-info select-file-btn">
    Click to Select
  </div>
</label>

<div>
      <input type="file" id="fileToUpload-1953" multiple="" onchange="angular.element(this).scope().setFiles(this)" data-upload-id="1953" class="hidden-uploader">
</div>
</form>
Run Code Online (Sandbox Code Playgroud)

selenium protractor

3
推荐指数
1
解决办法
5504
查看次数

标签 统计

elixir ×1

elixir-mix ×1

protractor ×1

selenium ×1