What should I do if I get the error "Unable to locate an element on a page"?

What should I do if I get the error "Unable to locate an element on a page"?

At times, some page elements can't be located due to network issues or loading issues. There are two methods of fixing the error: you can either check the root cause analysis (RCA) screenshot or you can edit the web script.


To fix the error by editing the web script:

  1. Log in to Site24x7.

  2. Navigate to Home > Monitors.

  3. Click the monitor of your preference.

  4. On the Monitor Status page that opens, click the hamburger icon next to the monitor name and click Edit Web Script.

  5. In the script that opens, add lines in the following format with appropriate values above the page elements that are unable to be located:

          
         

wait(<time in milliseconds>)

wait_for_element_presence(<element type>,<element name>,<maximum wait time in seconds>)
wait_for_element_visibility(<element type>,<element name>,<maximum wait time in seconds>)      
         For example, in the case of an XPath element, this is the format:
     

  wait("1000")
  wait_for_element_presence("xpath",".nav__inner .site-nav__spacer__top-handheld","40")
  wait_for_element_visibility("xpath",".nav__inner .site-nav__spacer__top-handheld","40")


          
Edit web script