L
L
LittleBob2022-02-20 22:30:52
C++ / C#
LittleBob, 2022-02-20 22:30:52

How to get text via XPath path in Selenium C#?

It is necessary to make an if condition that will compare the text located here.

<button class="button-ui notify-btn button-ui_blue" 
data-commerce-tartget="PRODUCT_NOTIFY">Уведомить</button>

full XPath of this piece: /html/body/div[1]/div[2]/div[7]/div[1]/button[2]
Is it possible somehow through the code using this XPath to find out what text is in it and do comparison in if? It's just that the text has two states "Notify" and "Receive". When Notify in it, one action must be performed, and when Receive - another. How to implement this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question