Getting Static Text?

40 views
Skip to first unread message

PopVerifyPete

unread,
Apr 19, 2021, 11:09:18 PM4/19/21
to Selenium Users
This is probably and easy one for most of you.  

I am learning Java Selenium TestNG and trying to get the static text: "No file chosen" in order to verify it is there.  If I actually click the "Choose File" button and upload a dummy file, I can get the text that will be in that same location as "No file chosen" but I cannot actually get the "No file chose" text.

This is the sample application url:

My code to get the text after loading a dummy file:

@FindBy(css = "input#uploadFile")
WebElement ChooseFile;
...
updown.ChooseFile.getAttribute("value"));

So it is actually the button element I am getting the text value from.
I tried different attributes and tried the .getText method but that did not work either.

Thanks in advance!
Reply all
Reply to author
Forward
0 new messages