Greetings Stack Overflow Community,
I have a quick question that, when answered, will help anyone else that is looking to use Selenium and C# to wait until text appears on a web page that is not a clickable link but that is shown within the label tag.
I have the following example code,
<div class="class1" style="style7">
<label id="statusBar" class="class2">Not Ready</label>
</div>
Using Selenium and C# I am trying to insert a wait until an expected condition that will pause the code and then resume once the condition is satisfied.
I can find the label and perform an action once it is found by XPath...
wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='statusBar']")));
But, when I try waiting for the "Not Ready" text to be visible within that label tag, the C# script is stuck at this point and can't find the text within the label.
This is what I have tried based upon several stack overflow articles that don't address this question.
wait.Until(ExpectedConditions.TextToBePresentInElementLocated(By.Id("statusBar"), "Not Ready"));
wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='statusBar']//label[contains(text(), 'Not Ready')]")));
wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='statusBar'][contains(text(), 'Not Ready')]")));
Any assistance would be greatly appreciated.