1

在此处输入图像描述

嗨,我正在使用katalon studio进行自动化测试。当我为输入文本框设置值时,系统在日志属性中提示错误如下:

Unable to set text '1' of object 'Object Repository/Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/Page_Welcome to KAPPS Factoring Sys (1)/input_model.buyerProgramStages_10' (Root cause: org.openqa.selenium.InvalidElementStateException: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'SGA1014', ip: '172.27.35.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.35.528161 (5b82f2d2aae0ca..., userDataDir: C:\Users\lixinyu\AppData\Lo...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.181, webStorageEnabled: true}
Session ID: 2e27edd7304a30bc2cc431c849c9e4b7)

所以我的测试用例的状态是失败的,但是,我最终能够在文本框中设置值。

谁能告诉我发生了什么?

我的脚本:

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

WebUI.openBrowser('')

WebUI.maximizeWindow()

WebUI.navigateToUrl('http://sgsgaapp80:18093/dash/landing.do')

WebUI.setText(findTestObject('Test BuyerProg/Page_Login to Kapps System/input_j_username'), 'lixin')

WebUI.setText(findTestObject('Test BuyerProg/Page_Login to Kapps System/input_j_password'), 'kpmg@123')

WebUI.click(findTestObject('Test BuyerProg/Page_Login to Kapps System/input_btnLogin'))

WebUI.click(findTestObject('Test BuyerProg/Page_KPMG System/div_India'))

WebUI.click(findTestObject('Test BuyerProg/Page_FactorPro - Welcome to KAPPS F/td_function changeRequestLocal'))

WebUI.click(findTestObject('Test BuyerProg/Page_FactorPro - Welcome to KAPPS F/a_SUPPLIER FINANCE'))

WebUI.click(findTestObject('Test BuyerProg/Page_FactorPro - Welcome to KAPPS F/a_Static Entry'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/div_hitarea expandable-hitarea'))

WebUI.click(findTestObject('Object Repository/Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/Page_Welcome to KAPPS Factoring Sys/li_Buyer Program Entry'))

// WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/a_Buyer Program Entry'))
WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_(ALL)    0AUTOBUY00 - 0'), 
    '0AUTOBUY00', true)

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_(ALL)    DB1 - DOM-Supp'), 
    'DB4', true)

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_form_2'))

WebUI.doubleClick(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.amo'))

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.amo'), 'Kevin Ng')

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerLimitID'), '9437523122C')

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.financeStage'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.financeStage_1'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.financeStage_2'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.financeStage_2'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/a_Indicators'))

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_Daily    Weekly    Mont'), 
    'W', true)

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.autoDebit'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.autoDebit_1'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_form_0'))

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_FIXED-TIER RATE'), 'M0', 
    true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages'), '5')

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_0 SBR (HKD)    1 USD LI'), 
    '9', true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_1'), '2')

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_2'), '30')

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_Document Date    Financ'), 
    'SFP001', true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_3'), '20')

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_4'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/a_Pre-acceptance'))

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_FIXED-TIER RATE_1'), 
    'M0', true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages'), '2')

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_5'), '2')

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_0 SBR (HKD)    1 USD LI_1'), 
    '9', true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_6'), '1')

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_7'), '35')

WebUI.selectOptionByValue(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/select_Document Date    Financ_1'), 
    'SFP002', true)

WebUI.setText(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_8'), '5')

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_model.buyerProgramStages_9'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_stage_0'))

WebUI.click(findTestObject('Test BuyerProg/Page_Welcome to KAPPS Factoring Sys/input_confirm_0'))

WebUI.waitForPageLoad(4)

String makerRef = new String()

makerRef = WebUI.getText(findTestObject('random/Page_Welcome to KAPPS Factoring Sys/span_Maker-Checker Ref  201712'))

println(('Required Maker Checker Reference should be as follows' + '\n') + makerRef)

String ref = makerRef.substring(20)

println(makerRef.substring(20))

WebUI.click(findTestObject('Test1_OR/Page_Welcome to KAPPS Factoring Sys/button_Logout'))

WebUI.closeBrowser(FailureHandling.CONTINUE_ON_FAILURE)

WebUI.callTestCase(findTestCase('SF 18093/checker-SF general'), [('makerReference') : ref], FailureHandling.STOP_ON_FAILURE)

我的舞台形式页面的html:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="k" uri="/extended-struts-tags"%>

<s:if test="%{model.csptProg!=null}">
    <s:url id="displayheader"
        action="/WEB-INF/pages/factorpro/_static/entry/buyerprogram/common/displayheader.jsp" />
    <s:include
        value="/WEB-INF/pages/factorpro/_static/entry/buyerprogram/common/displayheader.jsp" />
    <br />

    <div id="formDiv"><s:form action="stage" method="post"theme="kpmg_tabber">

        <s:url id="financestages"
            value="/WEB-INF/pages/factorpro/_static/entry/buyerprogram/common/form/financestages.jsp" />


        <s:url id="back" namespace="/createbuyerprogram" action="form" />


        <div class="tabber">
        <s:iterator value="model.buyerProgramStages" status="rowId">
            <div class="tabbertab">
            <h2><s:property value="stageName" /></h2>
            <s:include
                value="/WEB-INF/pages/factorpro/_static/entry/buyerprogram/common/form/financestages.jsp" />
            </div>
        </s:iterator>

        <%-- <div class="tabbertab">
        <h2><s:property value="%{getText('indicators')}" /></h2>
        <s:include
            value="/WEB-INF/pages/factorpro/_static/entry/buyerprogram/common/form/indicators.jsp" />
        </div> --%>

        </div>

        <s:if test="%{model.resubmitting}">
        <s:url id="owndashboard" namespace="%{dashboardnamespace}"
        action="%{dashboardaction}" />
        </s:if>

        <s:include value="/WEB-INF/pages/common/formparts/common.jsp" />
        <!-- For Maker checker Resubmit -->
        <s:include value="/WEB-INF/pages/common/workflow/resubmit-display-remarks.jsp" />
        <tr>
        <k:submit type="input" align="right" value="%{getText('submit')}"
            onclick="isCustomSubmit('stage','stage')" colspan="4" isfirst="true">
        </k:submit>
        <s:if test="%{model.resubmitting}">
            <k:submit type="input" align="right" value="%{getText('back')}"
                onclick="goto('%{owndashboard}');return false;"  islast="true" colspan="4">
            </k:submit>
        </s:if>
        <s:else>
            <k:submit value="%{getText('Previous Page')}" onclick="isBack('stage')" islast="true" colspan="4">
            </k:submit>
        </s:else>
        </tr>
    </s:form></div>
</s:if>
<s:else>
    <s:include value="/WEB-INF/pages/common/formparts/common.jsp" />
</s:else>
4

2 回答 2

1

没有相关的Code Trial和相关的HTML很难调试异常/错误。但是似乎存在以下问题:

这里的主要问题是您使用的二进制文件之间的版本兼容性,如下所示:

  • 您正在使用chromedriver=2.35
  • chromedriver=2.35的发行说明清楚地提到了以下内容:

支持Chrome v62-64

  • 您正在使用chrome=65.0
  • ChromeDriver v2.37的发行说明清楚地提到了以下内容:

支持Chrome v64-66

因此ChromeDriver版本 ( v2.35 ) 和Chrome 浏览器版本 ( v65.0 )之间存在明显的不匹配

解决方案

  • 将ChromeDriver升级到当前的ChromeDriver v2.37级别。
  • 将Chrome版本保持在Chrome v65.x级别。(根据 ChromeDriver v2.37 发行说明
  • 通过IDE清理项目工作区并仅使用所需的依赖项重建项目。
  • 使用CCleaner工具在执行测试套件之前和之后清除所有操作系统杂务。
  • 如果您的基本Web Client版本太旧,请通过Revo Uninstaller卸载它并安装最新的 GA 和已发布版本的Web Client
  • 重新启动系统
  • 执行你的@Test.

你是如何逃脱的

尽管您遇到了org.openqa.selenium.InvalidElementStateException并且您的测试将被中止,但KATALON STUDIO设法使会话保持活动状态并且您通过了。

于 2018-04-19T12:13:56.293 回答
0

将以下行添加到脚本中,就在显示错误的元素之前。

WebUI.delay(3)

它对我有用。

于 2018-09-20T11:32:41.670 回答