在量角器中上传外部文件

时间:2018-08-31 17:14:05

标签: protractor

我正在尝试使用量角器通过窗口弹出窗口上传远程文件,但是所有解决方案均无效。

请求某人请帮助

我的代码类似于:-

var remote = require('F:/ untitled / node_modules / selenium-webdriver / remote');                     browser.setFileDetector(new remote.FileDetector());

                var fileElem = element(by.css('input[type="file"]'));
                //files
                //var fileElem = element(by.css('div.file-uploader'));

                var absolutePath = 'F:/1778.docx';
                browser.switchTo().activeElement();
                browser.executeScript("arguments[0].style.visibility = 'visible'; arguments[0].style.height = '1px'; arguments[0].style.width = '1px';arguments[0].style.opacity = 1", fileElem.getWebElement());
                fileElem.sendKeys(absolutePath);
                browser.driver.sleep(100);*/

源代码类似于

             文件不掉             有空         

    <div ng-show="dropAvailable" ng-switch="buttonType" layout="row" layout-align="center center" class="">
        <!-- ngSwitchWhen: fab -->
        <!-- ngSwitchWhen: icon -->
        <!-- ngSwitchWhen: text-icon --><div class="file-upload-button ng-scope" ng-switch-when="text-icon">
            <button class="btn btn-primary ng-binding" aria-label="Add Attachment">Add Attachment <span ng-class="icon" class="glyphicon glyphicon-paperclip"></span></button>
        </div>
        <!-- ngSwitchDefault:  -->
    </div>
</div><!-- end ngIf: canUploadFn() -->
<!-- Display the existing files -->
<!-- ngIf: showAttachments -->

0 个答案:

没有答案