Reputation: 713
WebElement n=driver.findElement(By.cssSelector("tr:nth-of-type(1) > td:nth-of-type(7)"));
JavascriptExecutor j = (JavascriptExecutor) driver;
j.executeScript("arguments[0].click();", n);
HTML Page
<td class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignLeft"><span class="more-icon "><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg></span></td>
I tried action class & javaexecuter too but it didnt work.
Upvotes: 0
Views: 43
Reputation: 2101
I think you are trying to click on an SVG image, which are handled differently from the conventional elements.
driver.find_element(By.XPATH, "//*[name()='svg' and @class='MuiSvgIcon-root')]")
This should work, if the svg is what you are trying to click. If you have only one svg element in the DOM, then a simple svg locator like the below should work.
driver.find_element(By.XPATH, "//*[name()='svg']")
Upvotes: 1