Chrome headless

Ask general questions here.
spektr
Posts: 20
Joined: Thu Oct 22, 2020 11:53 am

Chrome headless

Post by spektr » Thu Oct 22, 2020 12:01 pm

Hi guys, i am knew to headless testing, so I have a small project in RanoreX for our web application. I want to test it in headless mode, but i get some errors in this mode that i don't know how to explain them. It's just a normal doubleclick or single click, nothing special. Other mouse clicks work fine, this one when i want to select and open a record, is not.

For instance:
Failed to find item 'ModuleLibraryRepository.KADRIS403ZaposlovanjeOdpoved.DatatableWrapper.IzbiraZapisa'. Please check that your whitelist allows Ranorex to access the process.
No element found for path '/dom//div[#'datatable_wrapper']/div/?/?/tbody/tr/td[6]' at step 'div' after 951 attempts within 54s (timeout factor = 0,6).
Show/Hide Stacktrace


another one:
01:22.970 Error Module
element not interactable(Session info: headless chrome=86.0.4240.111) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'NIKOLAJ', ip: '192.168.181.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: driver.version: unknown (60)
Show/Hide Stacktrace

Those errors are present just in headless testing, normal GUI test is fine.

I am runing out of ideas at the moment. If someone know something i will be glad :)

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

Re: Chrome headless

Post by odklizec » Thu Oct 22, 2020 10:02 pm

Hi,

As for the first problem, have you tried to create the snapshot (not screenshot) directly from recording? Then compare the xpath you are using with actual element in snapshot. My guess is that the xpath is not correct in headless mode? I would especially eliminate all element indexes (like [6]).

Unfortunately, I have no clue about the second error.

BTW, I t seems that error "element not interactable" is Selenium-related and it may be caused by not yet visible/available element. Check this post:
https://stackoverflow.com/a/61727535
I would suggest to add [@visible='true'] at the end of xpath of failing repo element.
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 » Fri Oct 23, 2020 6:59 am

Hi, thanks for your replay. I really appreciate it. First, I must figure out how to do snapshot, because I never did it before. I assume that there is a connection with datatables because, every time there is a click within datatable, test in headless mode give me an error.

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

Re: Chrome headless

Post by odklizec » Fri Oct 23, 2020 7:13 am

Hi,

You just need to add Create Snapshot action from "Add new action" list. And then you can find the snapshot in report. However, I'm not quite sure if this command is usable in webdriver mode? ;)
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 » Fri Oct 23, 2020 8:30 am

Hm, i set this create snapshot command, where should it be located?

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

Re: Chrome headless

Post by odklizec » Fri Oct 23, 2020 8:37 am

Hi,

You can find it Action Table >> Add New Action button...
https://www.ranorex.com/help/latest/ran ... ory-items/
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 » Fri Oct 23, 2020 8:45 am

Ah, silly me. I see it yes, but this only works in non-headless mode. In this mode everything works...dammit.

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

Re: Chrome headless

Post by odklizec » Fri Oct 23, 2020 9:05 am

Hi,

Well, it looks like something webdriver related? If you search internet, there is quite a lot of posts regarding the inability to find an element (using xpath) in headless mode. So I think you will have to try different xpath, but I agree that it might be quite hard without UI ;)

https://developers.google.com/web/updat ... ess-chrome
https://stackoverflow.com/questions/500 ... s-headless
https://stackoverflow.com/questions/509 ... ium-in-pro

BTW, are these iframes in tested web page? Iframes are often a cause of not found xpath, because webdriver needs to switch to correct iframe first!
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 » Fri Oct 23, 2020 9:44 am

Ok, thanks for links, will look about it on selenium forum. We are using div's.

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

Re: Chrome headless

Post by spektr » Fri Oct 23, 2020 1:29 pm

It looks like i am making some progress today..But..it's really pain in the ass.

What I've discovered is that div should be called with ID's. But now, i have problem with buttons :-) I am really not bored with this :)

So the problem is :
Item 'ModuleLibraryRepository....' is no Button.
The element does not support the required capability 'button'.

I don't know , maybe could be a problem with the web driver itself?

P.S.
I was too fast, now i am back to my first problem. Hm...from some reasone it stop recognizing some elements which were already recognized before, i don't know why..

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

Re: Chrome headless

Post by odklizec » Fri Oct 23, 2020 2:46 pm

Hi,

As for the button issue, try to change Button to ButtonTag in xpath of given repo element. This should help.

As for not recognizing elements, well, It's impossible to tell what's wrong without seeing the xpath and, at very least, snapshot. I understand that the xpaths work in UI mode and not in headless mode, but still... With snapshot we may suggest better xpath that you are currently using.
Last edited by odklizec on Fri Oct 23, 2020 8:36 pm, 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 » Fri Oct 23, 2020 6:56 pm

Yes, I think the root cause is there..at xpath. I will look and post my snapshot here. THanks

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

Re: Chrome headless

Post by spektr » Mon Oct 26, 2020 7:51 am

So, here is my snapshot file. ...and good week for everyone :-)
Attachments
snapshot.rxsnp
(191.14 KiB) Downloaded 8 times

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

Re: Chrome headless

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

Hi,

Please post also the xpath, which works in UI mode and fails in headless mode. Thanks.
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 9:46 am

I am sorry, but i can't find on ranorex site, how to create xpath file?
Last edited by spektr on Mon Oct 26, 2020 10:01 am, edited 1 time in total.