[英]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.