When I use the following code for click or double click using Actions class, it seems like mouse click triggers but is not released. Apparently, the button is highlighted, but click doesn't perform completely.
Click Code:
WebElement refreshPreviewButton = driver.findElement(By.xpath("//div[@data-dojo-attach-point='_previewInTabBtn']"));
Actions action = new Actions(driver);
// Approach 1
action.click(refreshPreviewButton).build().perform();
// Approach 2
action.movetoElement(refreshPreviewButton).click().build().perform();
Double Click Code:
WebElement refreshPreviewButton = driver.findElement(By.xpath("//div[@data-dojo-attach-point='_previewInTabBtn']"));
Actions action = new Actions(driver);
// Approach 1
action.doubleClick(refreshPreviewButton).build().perform();
// Approach 2
action.movetoElement(refreshPreviewButton).doubleClick().build().perform();
Working code of other element on the same page:
WebElement previewInTabButton = driver.findElement(By.xpath("//div[@data-dojo-attach-point='_previewInTabBtn']"));
Actions action = new Actions(driver);
action.doubleClick(previewInTabButton);
action.perform();
HTML:
<div class="c3_axnPrvCHR2 c3_rows_nowrap c3_align_center c3_hidden" data-dojo-attach-point="_r2Cont">
<div class="c3_axnPrvCBtns c3_axnPrvCBtnsL c3_rows_nowrap c3_align_center btn-sgmt-grp btn-group c3_br4 c3_bdr" data-dojo-attach-point="_btnsCont1">
<div class="btn-sgmt c3_btn btn-icn-sq btn-icn-sq-34" title="preview" data-dojo-attach-point="_previewBtn">
<svg class="c3i c3i_txt">
<use class="c3i_u" xlink:href="#zi-eye-inactive"></use>
</svg>
</div>
<div class="c3_bdr_r"></div>
<div class="btn-sgmt c3_btn btn-icn-sq btn-icn-sq-34" title="code" data-dojo-attach-point="_codeBtn">
<svg class="c3i c3i_txt">
<use class="c3i_u" xlink:href="#zi-code"></use>
</svg>
</div>
</div>
<div class="c3_axnPrvCBtns c3_axnPrvCBtnsR c3_rows_nowrap c3_align_center c3_gpC16" data-dojo-attach-point="_btnsCont2">
<div class="btn-default-outline2_new btn-sm c3_btn btn-fx" data-dojo-attach-point="_previewInTabBtn">
<svg class="c3i c3i_txt">
<use class="c3i_u" xlink:href="#zi-launch"></use>
</svg>
<div>Preview in tab</div>
</div>
<div class="btn-default-outline2_new btn-sm c3_btn btn-fx" data-dojo-attach-point="_refreshPreviewBtn">
<div>Preview</div>
</div>
</div>
</div>
Edit 1: Added HTML
Edit 2: Added working code of other element on same page