Is there an alternative way to replace 'Thread.sleep(5000)'? As currently, the commentsbutton only clicks once and will move on to the codes for repliesbutton even though there are other elements for commentsbutton? So i thought that it could be because of 'Thread.sleep(5000)' that the page is not done loading.
if(commentsbutton.size() > 0) {
commentsbutton.get(0).click(); //click on button if found
Thread.sleep(5000); //pause for 5 seconds
}
else clickMore = false;
if(repliesbutton.size() > 0) {
repliesbutton.get(0).click(); //click on button if found
Thread.sleep(5000); //pause for 5 seconds
}
else clickMore = false;
if(seemorebutton.size() > 0) {
seemorebutton.get(0).click(); //click on button if found
Thread.sleep(5000); //pause for 5 seconds
}
else clickMore = false;
}