元素在量角器中的点处不可点击



我有一个上传图像的模式。当我点击上传图像时,它正在导航到本地计算机,然后选择指定的图像。导航到本地计算机后,在中遇到错误。

错误:

消息:失败:未知错误:元素在点(736187)处不可点击。其他元素将收到点击:。。。(会话信息:chrome=54.0.2840.99)(驱动程序信息:chromedriver=2.25.426923(0390b88869384d6eb0d5d09729679f934aab9eed),平台=Windows NT10.0.14393 x86_64)堆栈:WebDriverError:未知错误:元素在点(736187)不可点击。其他元素将收到点击:。。。(会话信息:chrome=54.0.2840.99)(驱动程序信息:chromedriver=2.25.426923(0390b88869384d6eb0d5d09729679f934aab9eed),平台=Windows NT10.0.14393 x86_64)在WebDriverError(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\node_modeles\selenium webdriver\lib\error.js:27:5)在Object.checkLegacyResponse(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\error.js:639:15)在parseHttpResponse(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\http\index.js:538:13)在client_.send.then.response(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\node_modeles\selenium webdriver\http\index.js:472:11)在ManagedPromise.invokeCallback _(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\node_modeles\selenium webdriver\lib\promee.js:1379:174)在TaskQueue.execute _(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2913:14)在TaskQueue.executeNext_(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2896:21)at asyncRun(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2820:25)位于C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:639:7正在处理中_tickCallback(internal/process/next_tick.js:103:7)发件人:任务:WebElement.click()在Driver.schedule(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\webdriver.js:377:17)在WebElement.schedule_(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\webdriver.js:1744:25)在WebElement.click(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\webdriver.js:1845:17)在actionFn(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\builded\element.js:99:44)在Array.map(本地)位于C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\builded\element.js:406:46在ManagedPromise.invokeCallback _(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\node_modeles\selenium webdriver\lib\promee.js:1379:174)在TaskQueue.execute _(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2913:14)在TaskQueue.executeNext_(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2896:21)at asyncRun(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2775:27)错误在ElementArrayFinder.applyAction_(C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\builded\element.js:403:27)ElementArrayFinder_这(匿名函数)[点击](C:\Users\Telekha\AppData\Roaming\npm\node_modules\edractor\builded\element.js:101:30)在ElementFinder上。(匿名函数)[点击](C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\builded\element.js:740:22)在对象处。(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\example\loginpost.js:40:51)位于C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modules\jasminewd2\index.js:94:23在新的ManagedPromise上(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:1082:7)在controlFlowExecute(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\jasminewd2\index.js:80:18)在TaskQueue.execute _(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2913:14)在TaskQueue.executeNext_(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2896:21)at asyncRun(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modeles\selenium webdriver\lib\promee.js:2820:25)发件人:任务:在控制流中运行它("在仪表板上")在对象处。(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\node_modules\jasminewd2\index.js:79:14)来自异步测试:错误套房。(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\example\loginpost.js:16:2)在对象处。(C:\Users\Telekha\AppData\Roaming\npm\node_modules\practor\example\loginpost.js:1:1)在模块中_compile(模块.js:570:32)位于Object.Module_extensions..js(Module.js:579:10)在Module.load(Module.js:487:32)在tryModuleLoad(module.js:446:12)

2个规格,1个故障。

和我上传图像的代码:

element( by.css('[ng-click="imagePost()"]') ).click();   
browser.sleep(3000);
element(by.model("files")).click();
var path = require('path'); var fileToUpload = 'Desktop:/mdkg.jpg';
var absolutePath = path.resolve(fileToUpload); 
var button = element(by.css('[ngf-select]')); 
button.click(); 
var input = element(by.css('input[type="file"]'));     
input.sendKeys(absolutePath);
element(by.buttonText('Post Image')).click();

您可以使用等待元素来点击

var EC = protractor.ExpectedConditions;
var element = element(by.xpath([xpath_locator]));
browser.wait(EC.elementToBeClickable(element(by.xpath([xpath_locator]))), 30000).then(function () {
element.click();
});

您可以通过任何定位器来选择元素,在这种情况下,我通过xpath和来选择它

包含以下语句:

browser.driver.manage().window().maximize();进入

protractor.conf.js文件的onPrepare()方法如下所示。

onPrepare () {
browser.driver.manage().window().maximize();
}

相关内容

  • 没有找到相关文章

最新更新