If you know the x and y values of an element, but you don't know which element it is, how to locate this element through xMagol y

the current process is as follows:
1. The value in the pdf is extracted from the backend
2, the pdf is converted to HTML and displayed at the front end, and the value is extracted by highlighting the backend

.

so here comes the problem. The backend extraction is based on pdf extraction. You can only get the x and y values of the extracted element, but not the xpath, of the element. So how can you find the element

based on the x, y values?
Dom
Sep.03,2021

to answer myself, I finally used the elementFromPoint method. Although it was a bit troublesome and had a lot of judgment and calculation, the problem was solved

.
//--------------------------------------------------------------

found the elementFromPoint method, but because the calculation of this method starts from the upper left corner of the screen, and when the input value exceeds the screen size, it can only return null , so it cannot meet the requirements

.
Menu