Pressing a button, waiting for a dialog box and pressing a confirming button

Hello,

I downloaded Katalon Studio and tried to use it to test an automatically Completion of a project.
However, I am stuck and I don’t have much time to dig it further, nor enough knowledge about such automation.

I need (and I pay for this) a 3rd party tester from the community to discuss a bit and help me create the test.

Symfonie is the software that I am trying to test.

On the right, there is a button “Complete”. I need to press on it, but, after this, a confirmation dialog appears. I need to press OK on that, too.
I don’t know how to do this as scalable as possible (I do not want to click at a certain pixel position or something that is changeable).

Thank you,
costincca

Hello,

please share a source code of the page, so we can help you identifying the element.

I do not own this site and I am logged in with REST API. That said, I don’t have much control. But I can work with some tester that can help me.

That said, in Web Inspector, looks like this:

< a role=“menuitem” tabindex=“-1” href=“#” class=“reset-unsaved btn btn-sm btn-default btn-block spectest-taskAction” data-upload-disabled=“true” data-url=“/task/9836959/confirm?command=Complete” onclick=“VIEW.actionPanel.showTaskDialog(‘/task/9836959/confirm?command=Complete’)”>
Complete
</ a>

That “VIEW.actionPanel.showTaskDialog(‘/task/9836959/confirm?command=Complete’)” carries out the final action. VIEW is:
image

It looks like there’s some unique task ID used in this element. Do you know this ID before you run the test? Or are you able to get it from somewhere during test execution?

If not, you can try to use this XPath to get Complete button: //a[text()='Complete']
But as soon as you switch to other language or you have more Complete buttons, I’d crash.

We’ll need to see the HTML for this too

image

There is just 1 Complete and 1 language per task, so we are safe to assume it is unique.

Regarding the confirmation dialog box, it is like this:

< button type=“button” id=“taskActionConfirm” class=“btn btn-primary reset-unsaved” data-loading-text=“ OK”>
OK
</ button>

But after clicking the main Complete button, there is a short pause until this dialog box appears, so I should wait for its loading.

Assuming you get the Xpath working for the first button, then…

def taskConfirmButton = findTestObject("...")
WebUI.waitForElementVisible(taskConfirmButton, 10)
WebUI.click(taskConfirmButton)

If you want to ditch the Xpath stuff, you could get to the first button using something like this:

String js = '''
var btn = document.querySelector('#taskDetailSave').nextElementSibling;
btn.click()
'''
WebUI.executeJavaScript(js, null)

I’d like to use XPath, it seems clearer and shorter.
I’ll give it a try tonight and come back if I get stuck.

Many thanks,
costincca

Clearer? The weight of evidence (questions on this forum alone) runs counter to that claim.

Shorter? XPath tools are known for creating extremely lengthy paths experienced testers immediately start to hand optimize. And not just to remove fragility.

Reminder: The web doesn’t use or need XPath. Remove JS and CSS and the web (the world!) would collapse.

Hello @costincca

I am not sure of it but if you want to use Xpath may be you could try this?

TestObject button_confirm = new TestObject('Button Task Confirm')
button_confirm.addProperty('xpath', ConditionType.EQUALS, '//button[@id=\'taskActionConfirm\']')
WebUI.click(button_confirm)

This is just a try to give a “coup de pouce” not to make the world collapsing :wink:

1 Like

Thank you.
Will check and tell. I am not pro or against XPath at this time. Just it seems I can just replace a x-path without affecting the code, in case something changes there.

That’s a fallacy. Wherever a reference changes, something, somewhere needs to be updated/changed.

Here, let me show you CSS (two steps away from Xpath) settings:

image

I think that removes any doubt as to how XPath is somehow to be preferred. And really, is that CSS so lengthy?

Really, I have no issue with anyone preferring to use one locator system over another. But please don’t make false claims (to yourself or anyone else) about the “reasons” why.

And please, don’t take any of this as personal, it’s about the code/engineering. :slight_smile:

Hi Thomas,

Yes, it is simpler :slight_smile: Thanks.
And I don’t mind. In fact, I am very happy to learn and understand more.
For the moment, I cannot test it, as I have a pile of projects to deliver tonight (I thought I would finish earlier).
But as soon as I give a try, I will confirm.

Going ahead, if I have a list of links (projects) in a webpage and I want to execute the same steps for each project (enter each project’s page and press Complete), so the elements are not unique anymore, what would be the best approach?

The link is called “Translation”, and the section is called “IN PROGRESS”.

How can I loop through all existing similar links?
Thank you,
costincca
PS: I will compile the information, but I owe you a lot of beer!

That is a very different question. Please post a new topic. When this topic is marked with a solution, it won’t make sense to anyone searching for answers if it contains many different questions.

You can use the edit button to copy this post to a new topic/thread – or I can do it for you. Let me know.

(Also, the title of this topic should be changed - asking to employ someone/Job adverts are not allowed).

Yes, you’re right, I will post a new topic, but I’ll do in the morning, as I am way behind schedule with my deliveries.

Regarding the “hiring of a tester”, I previously asked on e-mail and I got an answer from William Keenan, from kms-technology, advising me to post on the forum.

Thanks!

Thanks.

FYI: Job ads are always taken down. Perhaps “William Keenan” needs to make a definitive statement and add it to the rules. But I doubt that will happen. This is just not “that kind of place”. However…

@devalex88 @ThanhTo please advise. If this kind of thing is going to be allowed, it should be sent to a separate category (preferrably one that is NOT included on the main page by default).

Regarding my second question, which is to gather all “Translation” links on a page, under a certain section, I just saw a related question below “Iterate on Email button”, so, I will wait for that topic to receive an answer.

2 Likes

Hi @costincca, I just wanna note that Katalon forum is, first and foremost, a community aimed to help Katalon users specifically and automated testers in general. That means it is assumed you’re an automated tester that is in need of some kind of technical help.

While there’s nothing wrong with job postings, and I myself don’t have anything against it, I’d recommend platforms such as LinkedIn and other platforms designed to attract talents for hiring. Job postings should be where job postings are desired, again, while I personally have no problems, other Katalon users may perceive them as inappropriate given what the usual activities on the forum are. It just isn’t a good place for them.

That said, glad you decided to get your own hands dirty, welcome to the community @costincca

Cheers !

2 Likes