I have been told that I can check the "z-index" attribute of web elements to check the depth of them. I first used one of the following two statements to locate the element successfully.
e = WebDriverWait(tA.driver,1).until(EC.visibility_of_element_located((By.XPATH, xPath)))
e = WebDriverWait(tA.driver, 1).until(EC.element_to_be_clickable((By.XPATH, xPath)))
Then I used the following python code with firefox and win10:
zi = e.value_of_css_property("z-index")
The webpage URL is https://irs.thsrc.com.tw/IMINT/ which has a pop-up message box.
I supposed that the z-index of this box should be one and the other elements should be zero. However, using the above python statement makes Selenium returned "auto" to all my queries.
I read some people suggested that z-index query does not work for element with position value "static".
So in the following page: http://aludratest.github.io/aludratest/xref/org/aludratest/service/gui/web/selenium/selenium2/ZIndexSupport.html
repeated query to the "z-index" property is done until it is not "auto".
But I tried this and it results in locating failure after a few trials.
My questions are the following:
- Can I change the position property of the element in this case ?
- Will it work if I change the position property of the element ?
Thanks