Div tag acting as buttons, and also Dynamic buttons like delete, report spam, etc

前端 未结 2 1908
失恋的感觉
失恋的感觉 2021-01-22 20:16

This is a practice test case where i have to login to gmail and click on all the checkbox in the dynamic web table and delete the mails. So i made the following code.

Th

2条回答
  •  野的像风
    2021-01-22 20:49

    You probably chose not so automation friendly web app like Gmail to start with. I believe they have deliberately developed Gmail client side in such a way that its harder for a Robot to perform actions.

    As for your question, I think the delete button appears a little after check boxes are clicked. So I believe you will have to explicitly wait for the button to appear. It's also possible that your xpath is not correct.

    You could try this,

    WebDriverWait wait = new WebDriverWait(driver, 60 /*timeOut in Seconds*/);
    wait.until(ExpectedConditions.
    visibilityOfElementLocated(By.css("div[data-tooltip='Delete']"))).click();
    

提交回复
热议问题