I have a dialog box appearing on my page every time I open it. I want to close it so that I can proceed with my programming. The dialogue box is like this image
I tried the following code :
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#psyma_layer_background div#psyma_header div#psyma_close_link_container div#psyma_close_link a#psyma_close_button_link")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div#psyma_layer_background div#psyma_header div#psyma_close_link_container div#psyma_close_link a#psyma_close_button_link")));
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("div#psyma_layer_background div#psyma_header div#psyma_close_link_container div#psyma_close_link a#psyma_close_button_link"))).click();
I did presence of element check, visiblity and clickability check so that I do not miss the element by any chance but it's not able to figure out the "X" sign and so not closing the dialogue box! Please help me out if you can, really struggling with this one
It seems you were pretty close. To close the dialog box appearing on your page you need to click on the element marked as X which is a
<a>
tag. So to invokeclick()
on the desired element you need to wait for the desired element to be clickable as follows:Code Block:
Console Output:
Browser Snapshot: