Keep on clicking button 1 until button 2 appears in selenium using java -


i testing native ios mobile app using selenium , appium java code. part of teardown, have keep on clicking "back" button until "setting" button appears can logout of application.

i tried few things using while not working. can please ?

try code may you

try {         boolean flag = true;         while(flag) {             webelement backbtn = driver.findelementbyname("back");             backbtn.click();             thread.sleep(1000);             boolean isfindsettingbtn = driver.findelementsbyname("setting").size() !=0;             if(isfindsettingbtn) {                 break;             }         }     }catch(exception e) {         e.printstacktrace();     } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -