Page 1 of 3

Chrome headless

Posted: Thu Oct 22, 2020 12:01 pm
by spektr
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 :)

Re: Chrome headless

Posted: Thu Oct 22, 2020 10:02 pm
by odklizec
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.

Re: Chrome headless

Posted: Fri Oct 23, 2020 6:59 am
by spektr
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.

Re: Chrome headless

Posted: Fri Oct 23, 2020 7:13 am
by odklizec
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? ;)

Re: Chrome headless

Posted: Fri Oct 23, 2020 8:30 am
by spektr
Hm, i set this create snapshot command, where should it be located?

Re: Chrome headless

Posted: Fri Oct 23, 2020 8:37 am
by odklizec
Hi,

You can find it Action Table >> Add New Action button...
https://www.ranorex.com/help/latest/ran ... ory-items/

Re: Chrome headless

Posted: Fri Oct 23, 2020 8:45 am
by spektr
Ah, silly me. I see it yes, but this only works in non-headless mode. In this mode everything works...dammit.

Re: Chrome headless

Posted: Fri Oct 23, 2020 9:05 am
by odklizec
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!

Re: Chrome headless

Posted: Fri Oct 23, 2020 9:44 am
by spektr
Ok, thanks for links, will look about it on selenium forum. We are using div's.

Re: Chrome headless

Posted: Fri Oct 23, 2020 1:29 pm
by spektr
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..

Re: Chrome headless

Posted: Fri Oct 23, 2020 2:46 pm
by odklizec
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.

Re: Chrome headless

Posted: Fri Oct 23, 2020 6:56 pm
by spektr
Yes, I think the root cause is there..at xpath. I will look and post my snapshot here. THanks

Re: Chrome headless

Posted: Mon Oct 26, 2020 7:51 am
by spektr
So, here is my snapshot file. ...and good week for everyone :-)

Re: Chrome headless

Posted: Mon Oct 26, 2020 9:23 am
by odklizec
Hi,

Please post also the xpath, which works in UI mode and fails in headless mode. Thanks.

Re: Chrome headless

Posted: Mon Oct 26, 2020 9:46 am
by spektr
I am sorry, but i can't find on ranorex site, how to create xpath file?