G
G
German2019-03-29 17:19:31
XPath
German, 2019-03-29 17:19:31

How to select an element that appears after loading?

When the page is loaded in the preloader, there is no style="display: none. When everything is loaded, this parameter appears.
How to compose an xpath to catch this element?

<body>
  <div id="preloader" class="default-preloader app" style="display: none;"> </div>
</body>

Just //div[@style...] doesn't work, because there are a lot of similar elements on the page.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Fov, 2019-03-29
@TokkeRout

//div[@id = 'preloader' and not(@style)]
//div[@id = 'preloader' and @style = 'display: none;']

I
Ilya, 2019-03-29
@glebovgin

If you look strictly at the xpath regardless of the rest of the context, then you can use several conditions in the selector:
In addition, you can check for the presence or absence of the parent element, the adjacent element, and anything else to uniquely identify the DOM object you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question