user4985 user4985 - 1 year ago 138
C# Question

Action class not accepting selenium driver as variable

I'm looking to scroll a webpage to view in selenium.
The example codes I got from online are as follows:

var element = driver.FindElement("element-id"));
Actions actions = new Actions(driver);

Yet when i utilize it this way:

IWebElement element = driverFF.FindElement(By.Id("qr_reply"));

Action actions = new Action(driverFF);

I get thrown a "Method name expected." error at the second line.

Any help will be greatly appreciated.

Answer Source

Actually you are using wrong class, As you see in the example code it should be Actions with OpenQA.Selenium.Interactions Namespace instead of Action as below :-

using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;

Actions actions = new Actions(driverFF);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download