Hi Folks, I am trying to validate text on a page where the element does not have a ‘value=xxx’ attribute. The text ‘FundName001’ and ‘FundName002’ as well as other entered data values display on the page but the following is not finding the text. I have tried several things to assert/validate the text but no luck so far… Has anyone dealt with this type of issue? Note: There are no iframes on this page.
HTML Element value:
<input id="fundName0" name="activePacFundEntities.fundName" placeholder="Fund name" required="" type="text" maxlength="40">
//Test steps that create the data for the page...
Possibly the text “FundName001” is not visible as a part of DOM. Therefore WebUI.verifyTextPresent does not help.
Which, if you weren’t aware, is the value sent to the page from the server. The value that is sent back to the server, comes from the
element.value property. In other words, you don’t want the attribute, you want the property. Testing docs tend to fuzzy up the distinction between the two, but for you, just do what Kaz hinted at:
String js = "return document.querySelector('#fundName0').value;"
Or perhaps because the element is an input tag you can see if the below works:
item = com.Tools.createTestObject('id("fundName0")')
WebUI.verifyElementAttributeValue(item, "value", "FundName001", 10)