Chrome headless

Ask general questions here.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 9:51 am

Hi,

Xpath is not a file. It's the address used in repository for each element. Just select the item in repository and press Edit in Spy button. Then copy entire xpath as shown in spy and paste it here.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 10:09 am

A ok, i thought...Ok, i know, that's basic of course :)
I thought that snapshot file already includes xpath..

Here it is for specific item. I have a few of them, but this is the first one..

/dom//?/?/?/table[@id='01040101030109_230']/tbody//i

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 10:27 am

Hi,

How sure you are that the table ID is persistent? Because it looks to me very random, which this leads me to believe, that it may change with each page load/page build? ;) I would suggest to use something like this instead:
/dom[@domain='zion:7777']//div[@id='datatable_wrapper']//table[@class~'kadris-datatable']//i[@class~'fa']
Last edited by odklizec on Mon Oct 26, 2020 10:48 am, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 10:44 am

Well, everytime i reload the page, i get the same id.
The second thing is, everytime i execute non-headless test, this button is not a problem at all. But everytime when I execute in headless mode, it fails..
So i guess this ID is fixed.
..
I checked at development, ...this is supposed to be fixed.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 10:49 am

Hi,

Just for the sake of test, try the xpath I suggested.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 10:54 am

Of course, I am on that already..But...where did you get those classes for instance, class 'fa'? Rx don't offer me such option, i get class 'fa fa-angle-double-right fa-lg' for instance.

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 11:03 am

Hm, If I put in this patch for this particular element, rx doesn't find anything.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 11:35 am

Hi,

I've used only part of the class value in the xpath, this is why there is '~' instead of "=". '~' means regular expression.

It's weird it does not find anything for you, because it definitely shows me one found element in Spy?
2020-10-26_11-34-03.png
2020-10-26_11-34-03.png (92.85 KiB) Viewed 180 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 11:40 am

Now it's find yes, i had to change the parent item xpath to .//.


I get this error now:
(Optional Action) Failed to find item 'ModuleLibraryRepository.KADRIS403ZaposlovanjeOdpoved.ADHOCDESIGNERTABLE.FaFaAngleDoubleRightFaLg'. Please check that your whitelist allows Ranorex to access the process.

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 11:45 am

This is my json:
{
"browserName": "chrome",
"chromeOptions": {
"args" : ["headless", "window-size=1920,1080", "start-maximized"]
}
}

I am thinking if this could be the cause, ..

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 11:51 am

And the xpath for this failing element is the one I suggested? I don't think that it has anything to do with json config. It must be something else. Unfortunately, I have no clue what else could be the cause of this problem. Unfortunately, headless testing is somewhat hard to debug. So try to search for similar issues via google. I saw several posts regarding this topic. It seems to be a quite common selenium issue? ;)

https://stackoverflow.com/questions/500 ... s-headless
https://stackoverflow.com/questions/509 ... ium-in-pro
https://github.com/SeleniumHQ/selenium/issues/4477
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 12:07 pm

Yes, this is my xpath now
2020-10-26 12_06_25-nikolaj - Remote Desktop Connection.png
2020-10-26 12_06_25-nikolaj - Remote Desktop Connection.png (103.45 KiB) Viewed 175 times

spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 12:19 pm

About headles...i went for this kind of test, because a normal GUI testing on my RDP isn't working, and i can't figure it why..I made some tweaks, but as soon as i minimize RDP windows, the test fails.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 12:20 pm

Try to remove '//' in front of first DIV. I see you already have '//' in "adhocdesignertable" root folder. So it makes no sense to have another '//' in first div. I don't think this will fix the problem but just in case, try it ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6795
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Chrome headless

Post by odklizec » Mon Oct 26, 2020 12:25 pm

The reason why RDP fails (when you minimize it) is, that RDP locks the desktop! This is a RDP feature! Once RDP window is minimized or closed, remote desktop is locked. And Ranorex cannot work with locked desktop!

You either need to use VNC (which survives minimizing or even closing its window) or you will have to implement RDP hack, to keep the desktop unlocked. You can find the hack mentioned here:
https://www.ranorex.com/help/latest/ran ... lRDPbrspan
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration