Set Text failing


#1

Hi,

I just started using Katalon Studio and am running into an error when performing Set Text - the script fails. I tried a number of things: setting focus, scrolling to the field, verifying existence which all passed.

I created and ran the script in Chrome.

Here is the script line that is failing:
WebUI.setText(findTestObject(‘Page_US Department of State Directorate of Defense Trade Controls/input_Transaction Number_transactionId_1’), ‘Test’)

Here is the object in the Object Repository:

Here is the Error Log Script Error log.txt (5.8 KB)

Here is the Transaction Number box from word:

Transaction Number

Thanks so much,
Eileen


#2

Basically, the element (text box?) is not “ready”. Understand that your test script can execute a million times faster than a browser can render controls on the page. So first you’ll need to wait until the control is ready -try a visiblity check:


#3

First of all, thank you for the suggestion of the verify element present - I had used a different verity initially.

Ok, this is what I tried:

  1. Prior to the ‘Set Text’ statement
    a. Put a ‘verify element visible’ with a wait of 30 seconds
    b Put a ‘verify element present’

  2. Here is what is happening:
    a. It ran correctly - yay!
    b. The next time I ran it,

    • cleared cache in the browser
    • and closed the browser,
    • it failed on the ‘create button’ above the failing ‘Set Text’ box
      c. Prior to the ‘Create button’
    • added a ‘wait element clickable’ with a wait time of 30 seconds’
    • added a ‘verify element clickable’
      d. Tried again and it failed on the set text
      c. Kept failing either on the set text or the create button.
  3. Not sure if I understand what is going on with the script.
    a. Do I need to increase the wait times?
    b. Is there another type of verification to do?
    c. Is Katalon just really fragile?

Thanks in advance,
Eileen


#4

Eileen,

In the words of John Lennon, “talking about music is like dancing about architecture” - same goes for code (i.e. it makes little sense!) :wink:

So, take a read of this, then post back with any relevant info (a dump of the code would be nice)…

But I will comment on this:

Not in the waitForElement* calls, no. That’s the amount of time to wait before it’s considered a failure, not the amount of time to wait before it does the verification.


#5

Here is additional information for the issues. I am attaching the reports from Katalon Studio and screen shots. Unfortunately, I don’t have access to the HTML code for the application.

Browser: Chrome

The only thing that I changed from the Katalon Studio web recording was:
1 folder names for the object repository due to length and to make them more meaningful
2. added in the verify and wait statements - I know I can remove the wait statements but did not want to play with the script.
3. Added a test suite so I could get reports
4. Messed around a little with the drop-down statement on the regcode test (I know it’s set up wrong, but am sending the report - I was thrilled that it got that far!)

Here are the attachments:

20190530_071705_1559215045462- regcode label.zip (486.3 KB)
20190530_071928_1559215188728-create button.zip (990.6 KB)
20190530_071520_1559214939271-set text field.zip (632.3 KB)

Thanks


#6

Can’t you just paste the code inline?


#7

Ok, here is the application code. Sorry it’s not formatted, but I went into F-12 and grabbed the code. Hope it helps. I’m at work and there are no formatting tools downloaded and we are not allowed to download any.

Create Button Code:

<style>

button, html input[type=button], input[type=reset], input[type=submit] {

-webkit-appearance: button;

cursor: pointer;

}

article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {

display: block;

}

body {

margin: 0;

}

html {

box-sizing: border-box;

}

*, ::after, ::before {

box-sizing: inherit;

}

button, input, optgroup, select, textarea {

color: inherit;

font: inherit;

margin: 0;

}

button {

overflow: visible;

}

button, select {

text-transform: none;

}

.usa-button, .usa-button-primary, .usa-button-primary:visited, .usa-button:visited, [type=button], [type=image], [type=reset], [type=submit], button {

-moz-osx-font-smoothing: grayscale;

-webkit-font-smoothing: antialiased;

margin-top: 0.5em;

margin-right: 0.5em;

margin-bottom: 0.5em;

-webkit-appearance: none;

-moz-appearance: none;

appearance: none;

background-color: #0071bc;

border: 0;

border-radius: 5px;

color: #fff;

cursor: pointer;

display: inline-block;

font-family: Source Sans Pro,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif;

font-size: 1.7rem;

font-weight: 700;

line-height: 1;

padding: 1rem 2rem;

text-align: center;

text-decoration: none;

width: 100%;

}

/* @media screen and (min-width:481px) */

.usa-button, .usa-button-primary, .usa-button-primary:visited, .usa-button:visited, [type=button], [type=image], [type=reset], [type=submit], button {

width: auto;

}

.create-form {

margin-left: 1rem;

}

.float-left {

float: left;

}

.usa-grid-full > :first-child, .usa-grid > :first-child, .usa-section > :first-child {

margin-top: 0px;

}

.usa-grid, .usa-grid-full {

max-width: 1040px;

margin-left: auto;

margin-right: auto;

}

.usa-grid {

padding-right: 1.5rem;

padding-left: 1.5rem;

}

/* @media screen and (min-width:600px) */

.usa-grid {

padding-right: 3rem;

padding-left: 3rem;

}

.usa-section {

padding-top: 3rem;

padding-bottom: 3rem;

}

/* @media screen and (min-width:600px) */

.usa-section {

padding-top: 6rem;

padding-bottom: 6rem;

}

.usa-grid, .usa-grid-full {

max-width: 1170px;

margin-left: auto;

margin-right: auto;

}

/* @media screen and (min-width:600px) */

.usa-section {

min-height: 400px;

}

.usa-grid-full::after, .usa-grid::after {

clear: both;

content: "";

display: block;

}

body {

background-color: #fff;

color: #212121;

overflow-x: hidden;

}

body {

font-size: 1.7rem;

}

.usa-focus, :focus {

outline: 2px dotted #aeb0b5;

outline-offset: 3px;

}

html {

font-family: sans-serif;

-ms-text-size-adjust: 100%;

-webkit-text-size-adjust: 100%;

}

html {

font-family: Source Sans Pro,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif;

font-size: 10px;

}

html {

font-family: "Source Sans Pro", "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;

}

</style>

</head>

<body><div class="ng-scope" ng-view=""><section class="usa-grid usa-section ng-scope"><nav class="split"><button class="float-left create-form" type="button" ng-click="ctrl.create(ctrl.submissionType)">Create</button></nav></section></div></body>

</html>

Here’s the Transaction Number code:

<div class="transactionId"><label class="required" for="transactionId">Transaction Number <i class="far fa-question-circle ng-isolate-scope" tooltip="dsp5/TransactionNumber"></i></label><input name="transactionId" title="Max characters: 40" class="ng-pristine ng-empty ng-invalid ng-invalid-required ng-valid-maxlength ng-touched" id="transactionId" required="" type="text" maxlength="40" ng-model="ctrl.model.transactionId"></div>

Select Reg code:

<div class="applicantId"><select name="applicant" class="ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched" required="" ng-model="ctrl.model.applicantId" ng-options="o as o for o in ctrl.reg()" ng-change="ctrl.applicantChange(o)"><option selected="selected" value="">- Select -</option><option value="string:K-5097" label="K-5097">K-5097</option><option value="string:M-5160" label="M-5160">M-5160</option><option value="string:M-5163" label="M-5163">M-5163</option></select></div


#8

Then how are you meant to do your job? If you are willing to do so, tell them I said they’re complete idiots - why employ someone to do a job and then tie their hands behind their back?

Sorry. But these idiots drive me crazy - they think their code is somehow tainted when exposed to the world.

Okay, so, from what I see they’re using angular. The controls you need are present and can be tested just fine.

Let’s look at the first one:

<input name="transactionId" title="Max characters: 40" class="ng-pristine ng-empty ng-invalid ng-invalid-required ng-valid-maxlength ng-touched" id="transactionId" required="" type="text" maxlength="40" ng-model="ctrl.model.transactionId">

If you use CSS the selector you need is:

input#transactionId

If you want to use XPath I suggest you use the F12 tools to make one. (Unless someone else can make one for you).

Once the transactionId element is visible then you should be able to call setText on it:


#9

Great…it is a pain not being able to have access to everything when you want it.
My real job is a functional, manual tester/manager but willing and able to learn automation.

Thanks for the info - that doesn’t sound too bad for the transaction id. I’m going to guess that the create button may have a similar issue or maybe I should just guess most of the fields will have the same issue of dealing with angular.

I’ll let you know if it works.


#10

Please do - feedback is everything.