How to find the element that displays and hides with in 2 seconds in selenium webdriver?

102 views
Skip to first unread message

Masood Ahmad

unread,
Jun 21, 2018, 8:33:44 AM6/21/18
to Selenium Users

total QA

unread,
Jun 25, 2018, 4:15:17 AM6/25/18
to Selenium Users
Hi ,

One way is  keep on polling for the Element using Explicit Wait by adding try catch block.

Logic:
                     for(int i=0;i<5;i++)
                    {
                               try{
                                              //find the element;
                                               if element is displayed
                                               break;
                               }
                                catch(Exception e)
                               {

                              }
                          Thread.sleep(1000);
                  }

Regards,

Latest Posts: 
Reply all
Reply to author
Forward
0 new messages