Reputation: 101
Is it true that DIV elements cannot be clicked with selenium Web Driver?
For Instance, I'm unable to click on delete button in Gmail
Am trying to locate the elemnt using XPATH = //div[@aria-label='Delete']
here, class names and id's are dynamic which changes for every session. Imean, for every Login and Logout. I want my script to be Robust to run at any time.
Upvotes: 0
Views: 240
Reputation: 641
It may derive because of gmail has async structure. You may wait to finish request after page load and after select action. If you can share code flow we can examine together.
Upvotes: 0
Reputation: 874
Have you tried using a different attribute ? For e.g. you can use
//div[@data-tooltip='Delete']
or
//div[@data-tooltip='Delete']/div/div
Upvotes: 0
Reputation: 3296
You can by class name or ID, e.g. with class:
driver.findElement(By.className("class")).click();
Or by element name:
driver.findElement(By.ByTagName("div")).click();
Or find the parent or child a
tag.
Upvotes: 1