Algorithm 3 Get Initial Position of Element |
function GetInitialPosition(host, path, element_id, offset)
Initialize headless Chrome browser with fullscreen and SSL error ignore options
Navigate browser to “https://{host}{path}”
Find the element on the webpage by its ID
Get the screen dimensions using PyAutoGUI
Retrieve browser window position
Calculate the center coordinates of the element
Adjust coordinates to be within screen limits and apply offset
Quit the browser
return Screen coordinates (screen_x, screen_y)
end function
|