我是Katalon工作室的新手,正在尝试运行我的测试用例,但始终如其所说:

错误:


  测试案例/登录失败,因为(of)(堆栈跟踪:com.kms.katalon.core.exception.StepFailedException:无法>单击对象'Object Repository / Page_BaseLine-test / input_Przypomnienie o fakturze'(根本原因:com。 kms.katalon.core.webui.exception.WebElementNotFoundException:ID为:“ Object Repository / Page_BaseLine-test / input_Przypomnienie o fakturze”的Web元素,位于“ By.xpath:> /// input [@ id ='SubmitButton']”找到)


我尝试手动进行操作,但是每次出现相同问题时,该怎么办?

这是我的源代码:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

WebUI.openBrowser('')

def plik = new File('Config.txt')

def lines = plik.readLines()

WebUI.navigateToUrl(lines[0])

WebUI.setText(findTestObject('Object Repository/Page_Demo version BaseLine/input_Login form_LoginTextBox'), lines[1])

WebUI.setText(findTestObject('Object Repository/Page_Demo version BaseLine/input_Login form_PasswordTextB'), lines[2])

WebUI.click(findTestObject('Object Repository/Page_Demo version BaseLine/input_remember me_LoginButton'))

WebUI.click(findTestObject('Page_BaseLine - test/a_Kontrahenci'))

WebUI.click(findTestObject('Page_BaseLine - test/a_Dodaj Kontrahenta'))

WebUI.setText(findTestObject('own/Page_BaseLine - test/input_Nazwa skrcona_ShortNameT'), 'greg12')

WebUI.setText(findTestObject('own/Page_BaseLine - test/textarea_'), 'Grzegorz Spytek12')

WebUI.click(findTestObject('Page_BaseLine - test/input_Przypomnienie o fakturze'))

WebUI.click(findTestObject('Page_BaseLine - test/input_Opis_CloseButton'))


感谢帮助。

最佳答案

xpath似乎不正确。您可以尝试删除“>”吗?



>//input[@id='SubmitButton']'

10-06 16:13