Handling Bootstrap popover messages used as validations

Hi

I am stuck with handling Bootstrap popover used as validation messages in a form. I don’t find a way to inspect those as its element locator does not shows up in Dev tool.

Is there a way to handle bootstrap popover in Katalon ?

Could not be inspected using Dev Tool
Check below image: While Inspecting, mouse pointer does not highlight this element.
And then it disappears

image

Just a guess, it’s a web component, using a shadow dom. To confirm, dig out what you can from DevTools and read about the relevant component in the Bootstrap docs. You might also search the web for “bootstrap automation testing” or similar to see how others might be doing it.

If it is a component, be sure to read this:

Objects used in these articles shows something in DOM. In my case it does not show anything in / around the field. And disappears.

Then it’s probably created dynamically, inserted into the dom, then destroyed. Likely it’s created via JavaScript.

Did you find anything useful in the bootstrap docs?

Is there a user event (like a click?) that causes it to appear? We might be able to sniff it out by investigating the event handlers.

Thanks @Russ_Thomas for your support and Effort.

I have actually found the way to handle this by using javascript editor.

Check This:

1 Like

Hi @write2amitv, I have the same issue that I need to verify if the error message is displayed for any field and those errors are thrown from the bootstrap popover. I looked into your solution but for me is_valid always returning false even though there is an error message. Are you still using the code and how is it working for you and what changes you made for that code.

My sample code is

WebElement field = driver.findElement(By.xpath(‘//input[@id=‘frstNm’]’))

WebElement registerBtn = driver.findElement(By.xpath(‘//div//button[text()=‘Register’]’))

registerBtn.click()
Boolean is_valid = ((js.executeScript(‘return arguments[0].checkValidity();’, field)) as Boolean)

String message = ((js.executeScript(‘return arguments[0].validationMessage;’, field)) as String)

println(is_valid)

html code: test.html (2.9 KB)

screenshot:

Hi Vinod,

Yes it is working fine for me. Alternatively, below statement also returns same result:

String message = driver.findElement(By.name("email")).getAttribute("validationMessage");

else get in touch with Developer for help with the you are writing.

Thanks

Thanks for your comment. it is working fine. The mistake I did was without entering the data into the field I was trying to check the message and so its returning false everytime. I thought the check is done only when the popover message is displayed which is wrong.