我正在使用Selenium(Java)使用Polymer 1.0测试我们的Web应用程序,其中包含许多组件,这些组件可以从chrome开发工具中选择,例如:
<vaadin-upload class="col-md-12 col-xs-12 style-scope volute-app-video-face2-module x-scope vaadin-upload-1" label="Select Video:" id="videoUpload" max-files="1" accept="video/*,audio/*" target="/path/file" tabindex="0" title="Select Video">
<div id="buttons" class="style-scope vaadin-upload">
<div id="buttonsPrimary" class="style-scope vaadin-upload">
<paper-button id="addFiles" class="style-scope vaadin-upload x-scope paper-button-0" role="button" tabindex="0" animated="" aria-disabled="false" elevation="0">SELECT VIDEO<paper-ripple class="style-scope paper-button">
<div id="background" class="style-scope paper-ripple" style="opacity: 0.00528;"></div>
<div id="waves" class="style-scope paper-ripple"></div>
</paper-ripple></paper-button>
<div id="dropLabel" class="style-scope vaadin-upload">
<div class="drop-label style-scope volute-app-video-face2-module">
<iron-icon icon="file-upload" class="style-scope volute-app-video-face2-module x-scope iron-icon-0"><svg viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false" class="style-scope iron-icon" style="pointer-events: none; display: block; width: 100%; height: 100%;"><g class="style-scope iron-icon"><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" class="style-scope iron-icon"></path></g></svg>
</iron-icon>
Drag and drop an MP4 or MOV file here (max 1GB)
</div>
</div>
</div>
</div>
<div id="fileList" class="style-scope vaadin-upload">
<template is="dom-repeat" as="file" class="style-scope vaadin-upload"></template>
</div>
<input type="file" id="fileInput" hidden="" class="style-scope vaadin-upload" accept="video/*,audio/*">
<paper-ripple id="dragRipple" noink="" class="style-scope vaadin-upload">
<div id="background" class="style-scope paper-ripple"></div>
<div id="waves" class="style-scope paper-ripple"></div>
</paper-ripple>
</vaadin-upload>
我在Selenium(Java)中的代码如下:
WebElement uploadElement = SuperTestScript.driver.findElement(By.cssSelector("input[id='fileInput'][accept^='video']"));
在Chrome上运行正常,但在Edge上运行失败,错误消息是: 不能集中 我尝试使用这种方式: Vaadin Upload File Path from Testing using Selenium 但仍然不起作用!任何人都可以帮助解决这个问题?赞赏先进!