Page 1 of 1

Do JS Range functions (caretRangeFromPoint()) work with JCEF

PostPosted: Thu Dec 01, 2022 7:18 am
by MariaSh
Hi,

Firstly, thanks for the useful comments on this community forum.

I need to get places (indexes) where the line breaks occurred in a plain html web page. I figured, that one way is to find them through js using Chromium + JCEF. In normal mode my js works, but in headless mode it can not get caretRangeFromPoint() and also all js range functions, are not working. (It still can get getClientRects())

(I found, that there was a bug with caretRangeFromPoint() when user-select: none; but this is not the problem in my case)

Is this expected behavior in headless mode?

I'm using in detailed MainFrame, but only with JS and Load handlers (and Chromium + JCEF in headless mode on UBUNTO.)

Thank you in advance

Re: Do JS Range functions (caretRangeFromPoint()) work with

PostPosted: Fri Dec 02, 2022 2:02 am
by Phylanx
Alternativly you can get the HTML via cefBrowser.viewSource and getSource (i guess) into a Java String and have a look on the content there.

Re: Do JS Range functions (caretRangeFromPoint()) work with

PostPosted: Fri Dec 02, 2022 2:37 am
by MariaSh
Thank you Phylanx, but I meant, that I need places, where browser decides to make a new line in the text of a web page. Excuse me, for not being clear and thank you again