VerifyTextPresent not working from Jenkins slave

Hi,

I have a page that loads and I want to verify elements on it. I started using only verifyTextPresent, but in a row with 8 colums, it only detected 4. I tried to change the last 4, creating test objects for them, and using waitforElementVisible, then using verifyTextPresent.

All the cases worked in Katalon Studio, it works. In Jenkins slave, it doesn’t work, it doesn’t find the last elements.

I am using Chrome and Katalon Studio 6.2.1.

Any help is welcome.

What type of element contains the text?

Hi,

It is a

In a span.

Thanks

Did you try targeting the span with verifyElementText?

I just did, it doesn’t find the element. I don’t understand, because in katalon studio I don’t have issues…

If you have any ideas, they are more than welcome.

Can I see the relevant lines of code? Working blind is not easy.

Yes. I just discovered where exactly is the problem, but I don’t know how to solve it.
When my page is not maximized, it shows only 5 columns. When in the test, I take out column 4,5,6 and 7, but I leave columns 1.2.3.4 and 8, the test works in Jenkins. I try putting a maximizeWindow() after changing the page, but it looks like in Studio it works, but in Jenkins, it doesn’t.

Here are the lines:

‘Open the browser’
WebUI.openBrowser(’’)

‘Maximize the window because there is a bug in the application and the sizes are absolute, not relative. Some elements won’t appear if the window is not maximized’
WebUI.maximizeWindow()

‘navigate to the signin url.’
WebUI.navigateToUrl(GlobalVariable.signin_url,FailureHandling.OPTIONAL)

def signinPresent = WebUI.verifyElementPresent(findTestObject(‘rep/input_Username_username’),4, FailureHandling.OPTIONAL)

if ( signinPresent)
{
‘Sometimes it takes a bit long to get the login page, so the script will wait until the element username is present.’
WebUI.waitForElementPresent(findTestObject(‘rep/input_Username_username’), 3)

‘Specify the user’
WebUI.setText(findTestObject(‘rep/input_Username_username’), ‘theuser’)

‘Specify the password’
WebUI.setEncryptedText(findTestObject(‘rep/input_Password_password’), ‘thepassword’)

‘Click on signin’
WebUI.click(findTestObject(‘rep/button_Sign in’))

}

‘Verify that you are logged in’

WebUI.maximizeWindow()

WebUI.verifyElementPresent(findTestObject(‘rep/test_object’), 10)
WebUI.verifyTextPresent(“Clients”, false)
WebUI.verifyTextPresent(“Client’s Name”, false)
WebUI.verifyTextPresent(“Id”, false)
WebUI.verifyTextPresent("phone ", false)

//if I add the text corresponding to the middle columns it fails, so I just write the last one.

WebUI.verifyTextPresent(“Last shopping date”, false)

And then it works. It is a problem with the maximizeWindow.

Thanks for your help and support.

Just a wild stab in the dark…

Do you think it might be the case that when the window is maxed, the text is off-screen somewhere? Can you stop the test right after maximizeWindow and check?

A screen shot of the AUT would be nice, too.

As it runs as windows scheduler task, the ui is not opened. It opens only if you use java web start by double clicking in the jnpl and in rhis case, it worka…

@Ibus anything here you’ve experienced?

@Russ_Thomas mostly, the only major issues i had with jenkins were caused by the classic error ‘between the chair and keyboard’ . and not only jenkins but any CI.
and here i was just describing myself.
running in ci require a beet more depth into the consistency of environment.
we tend to think that ‘it is working on my machine should work everywhere’ … well, this thinkink defeat the rule number 1 of testing. ‘what you see may not be all the time true’
(rule number 0 is consistency).
so … we may need more details in this matter to figure out what is hapening:

  • jenkins remote? or jenkins running on the same machine as the OP develop katalon cases?
    -if remote jenkins … it is master/slave … aka is spawning ‘executors’ at the runtime,or the master is also the ‘worker’?
  • if master/slave … what type of the workers we have? created on the fly or permanent?
  • and if we know about workers … do they fulfill the katalon requirements? java 8 at least? and not any other version?

you see … lot of stuff may be out of our controll if we dont understand the full picture of our beatifull test design. so a bit of devops knolwdge cannot harm for a tester …

1 Like

And the rest of us. I have the scars to prove it (not going to mention the ones that are still bleeding :wink: )

1 Like

@Russ_Thomas one day we may compare our ‘scars’ into the lounge.
for now let’s wait for additional input … and yeah, i am posting from the dumbphone again (appologies for typo’s), but i have also a rule ‘-1’. there is no need for an IDE, the first and the only debugger should be our mind
we will fix it, no worries

That’s fine. The signal-to-noise ratio is good enough :wink:

1 Like

When you say ‘running fine in Studio’ are you using headless mode?

Mostly, your issue seems to be related to the display size. When running from jenkins on a linux executor, an virtual display is used (xfvb). On windows … I have no idea what is actually using.

found some tips here (if this is the case):
https://docs.katalon.com/katalon-studio/docs/common-configuration.html#download-katalon-studio-version

X11 DISPLAY (for Linux)

E.g.: This value will be used as the DISPLAY environment variable. Jenkins must be allowed to connect to the display, see xhost if you encounter access control issues.
Xvfb-run configuration (for Linux)

E.g.: -a -n 0 -s "-screen 0 1024x768x24".

If specified, xvfb-run will be used. Please make sure Xvfb has been installed.

Save the configuration after finishing.

LE: you can play with the ‘Responsive Design’ feature from DevTools to check how your page is rendered at various resolutions. Both Firefox and Chrome have it.
Once you figured out the right size, you can simply set the window size, instead of maximize, by the code or via project settings. Chromedriver does have such capability,afaik.
it may be a good chance to just work, no matter of the virtual display size (even if the virtual display is smaller than the window)

Hi Ibus. I am working with an architecture master slave, where the slave is permanent and it is a windows 16 server. The slave has only java 8 installed and if I run there the script with Studio, it works.
The master jenkins is linux redhat, but the script runs in the slave.
Wen I say “I run it with Studio” I mean that I go to the slave, open Katalon Studio, and run it from there.

Thanks for your help and your support

@spr2019 yeah, now i got the full picture.
however, last detail: when you trigger it from jenkins master, is running headless? and when you do it straight from slave, are you using headless too? or you just start it from gui with the ‘normal’ driver?
try the setWindowSize approach, that should do the trick, if not we will loock deeper (one full execution log may be needed)

I have tried these 2 things, but none worked (after checking the screen resolution):

window().setSize(new org.openqa.selenium.Dimension(1920, 1080))
WebUI.setViewPortSize(1920, 1080)

None of these options did fix the issue.

Any help is welcome.

@spr2019

@Ibus has asked you a question - twice? three times?

Are you running the tests headless?

Hi Russ_Thomas,

Sorry about zapping that question. No, I don’t use Chrome headless, I use Chrome.

Thanks for your help and support.