0

I am trying to perform a mousehover and then click on a submenu that wasn't present

This is my code:

private By RMenu = By.LinkText("Reports");

public HomePage SetMenu(string menu)
{
    Actions Rmouseover = new Actions(_driver);
    Rmouseover.MoveToElement(RMenu).Perform();
    return this;
}

And I am getting this error at (RMenu) Rmouseover.MoveToElement(RMenu).Perform():

cannot convert from 'openqa.selenium.by' to 'openqa.selenium.iwebelement'

I have tried Rmouseover.MoveToElement(RMenu).Build().Perform() and I still get the same error. What am I doing wrong or what am I not doing?

1 Answer 1

3

MoveToElement receives IWebElement as parameter, not By.

private By RMenu = By.LinkText("Reports");

public HomePage SetMenu(string menu)
{
    IWebElement element = driver.FindElement(RMenu);
    Actions Rmouseover = new Actions(_driver);
    Rmouseover.MoveToElement(element).Perform();
    return this;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.