Currently utilizing the Selenium web driver from this link to test a website. My goal is to determine if my view is positioned at the top of the entire screen.
I have tried using both isDisplay()
and getLocationInView
, but they only provide absolute position or display information relative to the element and HTML page, not the actual view itself.
Experimented with execute()
and eval()
to execute JavaScript code to capture the window and evaluate its axis value, since Selenium operates in a real browser (Chrome).
For example:
...execute("window", function(error, result) { console.log(result) };
...execute("console.log(window)", function(error, result) { console.log(result) };
...execute("return window", function(error, result) { console.log(result) };
However, these statements returned null
as the result.
Despite reading through the API documentation multiple times, I believe I may have overlooked a necessary function.
My initial idea was to trigger a JavaScript variable within the testing browser, run a brief function to obtain the axis value, and store it in a variable. But even accessing the window
global variable proved to be a challenge.
*Note: The executeScript
is no longer available in the version of Selenium I am using currently (latest version based on my package.json).
*Important reminder:
I am utilizing wd.js
as the web driver
link here