Test Element only has SPAN Class - Need to Verify Message

133 views
Skip to first unread message

John Pulwers

unread,
Mar 30, 2020, 9:26:59 PM3/30/20
to seleniu...@googlegroups.com
Below is the HTML for a text field I cannot Verify followed by the XPATHa I've tried to use which doesn't work.  I'm new at Selenium WebDriver C# with NUnit, and am prfiicent with ID/NAME for Web Elements, but I'm not sure how to Verify this SPAN Text  with a Class. Should I try some CSS Selector? Is there more the XPath needs?

HTML:
image.png

C# CODE:
            // Check if text element is visible (/html/body/div[1]/div[1]/div[2]/div/div[1]/div/div/div/div/ul/li/span)
            Assert.IsTrue(driver.FindElement(
            By.XPath("//*[@id='auth - warning - message - box']/div/div/ul/li/span/text")).Displayed);

Virus-free. www.avast.com
Message has been deleted

John Pulwers

unread,
Mar 31, 2020, 1:39:02 PM3/31/20
to seleniu...@googlegroups.com
OK (see new HTML below). I do appreciate your help on this. The BUILD is successful, but when I run the script, it shows no output, no success, no failures, just "updated".  

HTML:
image.png

Virus-free. www.avast.com

On Tue, Mar 31, 2020 at 9:59 AM MEA Engg QA <mea.e...@gmail.com> wrote:
I am going to take a stab at this:

Does this not identify your element uniquely?   //span[contains(text(),'text I want to verify here')]

It may help if you could provide us with more HTML from above the element that you want to identify uniquely...

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d9f5ccc8-702f-4230-95d6-98b5754e7a8b%40googlegroups.com.

John Pulwers

unread,
Apr 2, 2020, 12:27:47 PM4/2/20
to seleniu...@googlegroups.com
Yes, it does indeed identify the element uniquely. Thanks a bunch. I'll use that followed by a Console.WriteLine to verify the assertion in the report.
Reply all
Reply to author
Forward
0 new messages