Search This Blog

Breaking

Friday, 31 July 2020

July 31, 2020

Inspect disappearing element in a browser for UI automation

Recently, I came across a scenario in UI Automation where I need to validate a particular warning text which appears when I bring focus to inside a text field. The scenario was very easy because I just need to compare two string, one which was expected and the other one which was coming from the page. Today, when I was automating it, I observed, when I try to do right-click to open chrome console or ctrl+shift+i, It makes disappear the warning. It is because the control gets lost from the text field.

So to find the locator of this element, I followed the below approach (In chrome):

  1. Open console
  2. Type in setTimeout(()=>{debugger;},5000);
  3. Press Enter
It pauses the page for a few seconds which you have specified. 
When the page was paused, it allowed me to move the cursor to warn text without executing any code in the background. 





#Tricks #DynamicElementIdentification #UIAutomation