简体   繁体   English

在无头模式下使用 Chrome 驱动程序配置时,在 WebDriverSampler 脚本中遇到预期条件失败错误

[英]Facing expected condition failed error in WebDriverSampler script while using Chrome driver config in headless mode

I have the following code:我有以下代码: 在此处输入图像描述

When I run it I face with the followings:当我运行它时,我面临以下问题:

2020-07-08 12:47:49,053 ERROR c.gjpwsWebDriverSampler: Expected condition failed: waiting for presence of element located by: By.name: identifier (tried for 15 second(s) with 500 milliseconds interval) 2020-07-08 12:47:49,053 错误 c.gjpwsWebDriverSampler:预期条件失败:等待存在的元素位于:By.name:标识符(尝试 15 秒,间隔 500 毫秒)

2020-07-08 12:47:49,084 INFO oajtJMeterThread: Thread is done:Browser 1-1 2020-07-08 12:47:49,084 信息 oajtJMeterThread:线程已完成:浏览器 1-1

2020-07-08 12:47:49,084 INFO oajtJMeterThread: Thread finished: Browser 1-1 2020-07-08 12:47:49,084 信息 oajtJMeterThread:线程完成:浏览器 1-1

2020-07-08 12:47:49,663 INFO oajeStandardJMeterEngine: Notifying test listeners of end of test 2020-07-08 12:47:49,663 信息 oajeStandardJMeterEngine:通知测试侦听器测试结束

2020-07-08 12:47:49,664 INFO oajguJMeterMenuBar: setRunning(false, local ) 2020-07-08 12:47:49,664 信息 oajguJMeterMenuBar:setRunning(假,本地

Can anyone help me out with this error?谁能帮我解决这个错误?

When I open your https://somatus-dev-uat.azurewebsites.net URL I'm getting the following page:当我打开你的https://somatus-dev-uat.azurewebsites.net URL 我得到以下页面:

在此处输入图像描述

which doesn't contain any element with the name attribute of identifier , most probably this is the reason for your test failure.其中不包含任何具有name 属性的元素identifier ,很可能这是您的测试失败的原因。

So before running your test in headless mode make sure that it's running fine in GUI mode.因此,在以无头模式运行测试之前,请确保它在 GUI 模式下运行良好。

If this is something you cannot do for any reason, consider taking a screenshot in case of failure, something like:如果这是您出于任何原因无法执行的操作,请考虑在失败的情况下截屏,例如:

var exception = null
try
{
    wait.until(pkg.ExpectedConditions.presenceOfElementLocated(pkg.By.name('identifier')))
}
catch (err)
{
    WDS.log.error(err.message)
    var screenshot = WDS.browser.getScreenshotAs(pkg.OutputType.FILE)
    screenshot.renameTo(new java.io.File('screenshot.png'))
    exception = err
}
finally
{
    throw (exception)
}

More information: The WebDriver Sampler: Your Top 10 Questions Answered更多信息: WebDriver 采样器:您回答的 10 大问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Java在Chrome驱动程序中运行无头模式 - How to run headless mode in chrome driver using java 未知错误:Chrome无法启动:崩溃(硒,无头模式) - unknown error: Chrome failed to start: crashed(selenium ,headless mode) Selenium Webdriver:预期条件失败:等待 IAP Google 处于无头模式的元素的可见性 - Selenium Webdriver: Expected condition failed: waiting for visibility of element located in headless mode for IAP Google 由于预期条件失败而面临错误:等待警报出现(尝试 5 秒,间隔 500 毫秒) - Facing error as Expected condition failed: waiting for alert to be present (tried for 5 second(s) with 500 milliseconds interval) 使用 chrome 无头浏览器时未下载文件 - File is not downloading while using chrome headless browser 在新标签页中切换时无法在 Chrome Headless 模式下捕获屏幕截图 - Unable to capture screenshot in Chrome Headless mode while switched in new tab 如何使用 xvfb 将 Chrome 驱动程序服务与所需的无头功能合并? - How to Merge Chrome driver service with desired capabilities for headless using xvfb? 在 Java 中使用 selenium 在无头模式下启动 chrome 时会出现错误 - Launching chrome in headless mode with selenium in Java giving error 按钮在无头模式下无法按预期工作 - Button not working as expected in headless mode Selenium Remote WebDriver 在无头模式下使用 Chrome 获取画布内容 - Selenium Remote WebDriver get canvas content using Chrome in headless mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM