Method and way to highlight the validation message in the web page by using Selenium IDE



  • Is there is any way to highlight the validation message by using Selenium IDE?

    Example: During login when the user passes the invalid input the validation messages and login will be failed. I want to highlight the validation message which is getting displayed on the screen.



  • You can use the "run script" command with JavaScript code in the target field.

    Here some example code to highlight the first h1 element on a page with XPath:

    document.evaluate('//h1', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.setAttribute('style', 'outline: red dashed 5px !important')
    

    I can't seem to pass found elements with Selenium IDE, so you need to locate in JavaScript code.

    Looks something like this:

    enter image description here



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2