Page 1 of 1
How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 1:05 pm
by mmahra
Hello,
I am trying to validate a string in page using Ranorex Studio
I am able to run it on normal browser using either Key press (Ctrl+F) or click on chrome menu and select find then type my string,
Both ways are not working on headless with below error, is there a workaround for that?
Re: How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 1:11 pm
by odklizec
Hi,
As before, please post a Ranorex snapshot of the problematic element (parent/main form). My guess is that the xpath is simply not compatible? I'm not quite sure if Create Snapshot action is applicable with webdriver integration? Just give it a try
Re: How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 1:28 pm
by mmahra
Where exactly do I create the snapshot?
Re: How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 1:39 pm
by odklizec
Hi,
Add new action (Create Snapshot) right before the failing action. And make sure the action is connected with repo element, ideally DOM element.
Re: How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 5:03 pm
by mmahra
Unfortunately, fixing the XPath this time is not working for headless browser.
Re: How to find a sting in browser page using headless driver
Posted: Thu Mar 05, 2020 7:35 pm
by Vega
Are you able to create a Ranorex snapshot of the repo element from the working machine? If needed you can learn to create a snapshot below:
https://www.ranorex.com/help/latest/han ... -snapshot/
I assume you are using a webdriver endpoint in order to test via a headless browser. The thing that sticks out to me is that your RX path is trying to find a form object:
Code: Select all
/form[@title>'Jive Admin Console : Logging']
The problem is that a webdriver endpoint cannot interact with anything other an a web element (WebDriver limitation). This object appears to be outside of the DOM which is why the webdriver cannot find it. A form element is most likely a browser control (not an actual web element) but it is hard to say without seeing a Ranorex snapshot. This is something that Ranorex can see no problem because it can recognize a lot more than just web object, but webdriver can only see items within the DOM (without the use of Selenium API).
So yeah if you are able to share a snapshot, it should tell us a lot.
hope this helps
Re: How to find a sting in browser page using headless driver
Posted: Fri Mar 06, 2020 8:42 am
by odklizec
Hi,
Vega is absolutely right! Webdriver cannot handle elements outside DOM. I completely missed that the failing xpath starts with form
So the only way around is to eliminate all steps involving elements outside DOM. Or not to use headless/webdriver approach
Re: How to find a sting in browser page using headless driver
Posted: Fri Mar 06, 2020 10:44 am
by mmahra
Thanks vega
Re: How to find a sting in browser page using headless driver
Posted: Fri Mar 06, 2020 10:45 am
by mmahra
Thanks Pavel, I will consider your recommendations.