【发布时间】:2019-09-12 16:02:30
【问题描述】:
我正在尝试捕获并验证单击链接后出现在微调器中的文本。是否可以在 Katalon 中进行这种类型的测试?
我创建了以下关键字:
@Keyword
def activitySpinner(){
def activSpinner = WebUI.getText(findTestObject('Object Repository/WMS/Page_Dashboard/div_System Activity Loading Please Wait )'))
return activSpinner
}
然后我尝试了以下脚本来使用关键字:
def actSpinner = CustomKeywords.'com.wms.modules.general.ModuleKeywords.activitySpinner'()
if (WebUI.verifyMatch(actSpinner, 'System Activity Loading... Please Wait :).*', true, FailureHandling.STOP_ON_FAILURE)){
println("The spinner shows the text: " + actSpinner)
}
DOM 显示如下:
<script type="text/javascript" src="http://10.150.2.43:10093/js/jquery/jquery.page.1562162263.js"></script>
当我右键单击并打开上面的内容时,我会看到该特定链接的以下内容:
$j(document).on("click", "#system_activity", function() {
showLoader('System Activity Loading...');
window.location=BASE_URL + "erp/wms/statistics";
“请稍候:)”部分显示在页面上:
function showLoader(msgText,visible){
if(typeof(msgText)==='undefined') msgText = "Loading...";
var theme = "a",
textVisible = true,
textonly = false;
html = "";
msgText = msgText + ' Please Wait :)';
if(typeof(visible)==='undefined'){
$j.mobile.loading( 'show', {
text: msgText,
textVisible: textVisible,
theme: theme,
textonly: textonly,
html: html
});
}else{
$j.mobile.loading( 'hide' );
}
微调器显示文本“System Activity Loading... Please Wait :)”,这是我需要在 Katalon Studio 中验证的内容,但在运行脚本后出现以下错误:
09-12-2019 10:55:07 AM Test Cases/regression/WMS/C16320 - Activity Module
Elapsed time: 1m - 4.408s
com.wms.modules.general.ModuleKeywords.activitySpinner:92
com.wms.modules.general.ModuleKeywords.invokeMethod:0
Test Cases/regression/WMS/C16320 - Activity Module FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to get text of object 'Object Repository/WMS/Page_Dashboard/div_System Activity Loading Please Wait )'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.GetTextKeyword.getText(GetTextKeyword.groovy:88)
com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1568303703564.run(TempTestCase1568303703564.groovy:21)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/WMS/Page_Dashboard/div_System Activity Loading Please Wait )' located by 'By.xpath: //*[(text() = 'System Activity Loading... Please Wait :)' or . = 'System Activity Loading... Please Wait :)')]' not found
有什么想法吗?
【问题讨论】:
标签: katalon-studio