EDIT:
Make sure the dom is loaded
Like atri said, you could use the double click function according to This thread.
WebElement logout = driver.findElement(By.id("dijit_form_Button_0_label"));{
if(logout.isDisplayed()){
logout.doubleClick();
if you don't want to use the doubleClick function, I would recommend the ExplicitWait from Selemium
Selenium: Implicit and explicit Wait
If you want to do this manually, could add a delay between your click using javascript Thread and selenium wait.
Based on This thread
WebElement logout = driver.findElement(By.id("dijit_form_Button_0_label"));{
if(logout.isDisplayed()){
logout.click();
Thread.sleep(100);
logout.click();
}
Better way is to use ExplicitWaits which you means you will wait
exactly as long as some action happens or some element gets rendered
on the page.
- petr-mensik
An explicit waits is code you define to wait for a certain condition
to occur before proceeding further in the code. The worst case of this
is Thread.sleep(), which sets the condition to an exact time period to
wait. - Selenium