Reputation: 91
Help me please. Selenium does not click on element and element is clickable(selenium does not generate exception). I try use Id, css, xpath locators, nothing did not help me.
What should i do to decide my problem?
Java code example.
WebElement sector = webDriver.findElement(By.id("sector-1"));
sector.click();
After click system must open this page
Upvotes: 0
Views: 485
Reputation: 91
I decide my problem.
WebDriverWait wait = new WebDriverWait(webDriver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"sector-2:canvas\"]")));
WebElement svgObject = webDriver.findElement(By.xpath("//*[@id=\"sector-2:canvas\"]"));
Actions builder = new Actions(webDriver);
builder.click(svgObject).build().perform();
Upvotes: 0
Reputation: 52685
Seems that you try to interact with object inside a <svg>
element. If so, you cannot manage it's child elements simply using click()
method.
Try this instead:
WebElement svgObject = driver.findElement(By.xpath("//polygon[@id='sector-1:canvas']"));
Actions builder = new Actions(driver);
builder.click(svgObject).build().perform();
Upvotes: 1
Reputation: 1668
Use below XPath :
WebElement sector = webDriver.findElement(By.xpath("//g[@id='sector-1']/polygon"));
sector.click();
OR
WebElement sector = webDriver.findElement(By.xpath("//polygon[@id='sector-1:canvas']"));
sector.click();
Upvotes: 0