0

I would like to seek for your help. Seems I need another eyes to look into my script as it is not working. I do not know what is wrong with the code. Did I missed something?

Below is my script:

DriverUtils.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Actions action= new Actions(DriverUtils.getDriver());              
WebElement fundAllocation = DriverUtils.getDriver().findElement(By.xpath("(*//div[@data-index = '" + dataIndex + "']/descendant::div//*[contains(@class, 'mli-donut-chart')]//*[contains(@transform,'translate')]//*[contains(@style,'fill-opacity: 1')])["+ x +"]"));
action.moveToElement(fundAllocation).build().perform();

I also try this one on perform, but still didn't work.

action.moveToElement(fundAllocation).click().build().perform();

Toshi
  • 71
  • 1
  • 10

1 Answers1

0

You at least first need to define import Actions and define action:

in your imports add

import org.openqa.selenium.interactions.Actions;

Then before you perform the action with something like

Actions action = new Actions(DriverUtils.getDriver());
action.moveToElement(fundAllocation).click().build().perform();

Does that help?

C. Peck
  • 3,641
  • 3
  • 19
  • 36
  • This is currently my code/script - However, I do not see the mouse pointer moving into the object... and it is not hovering the object.. – Toshi Mar 14 '19 at 10:46
  • What if you add a `.click()` before `.build()` -- edited into my answer. – C. Peck Mar 14 '19 at 10:52
  • Yes,I already did that, still not work. Is there any othre way to do a mouse over? Thanks – Toshi Mar 14 '19 at 10:54
  • Ugh I hate `Actions`, they never work. Sorry, not sure how to fix this. – C. Peck Mar 14 '19 at 10:55