Object reference not set to an instance of an object. at OpenQA.Selenium.Interactions.Actions.Perform()
Meta -
OS:
Windows 10
Selenium Version:
3.6
Browser:
Chrome
Browser Version:
Version 62.0.3202.75 (Official Build) (64-bit)
Expected Behavior -
When performing an Action i'd expect it to work
Actual Behavior -
Throws an error:System.NullReferenceException : Object reference not set to an instance of an object. at OpenQA.Selenium.Interactions.Actions.Perform() when .Perform is called
Steps to reproduce -
Using C# bindings create a simple test
var actions = new Actions(browser);
actions.MoveToElement(element).Build();
actions.Perform();
Notes -
I can get this to work with 3.6 at all.
You have built sequence and than called method Perform() which builds sequence again.
Try to build sequence of actions on this way:
Actions actions = new Actions(browser);
actions.MoveToElement(element);
Action moveToElement = actions.Build();
moveToElement.Perform();
Besides that I recommend you to read this wiki.
Thats odd it works fine on 3.0.1 i'll try your suggestion.
the above you quoted wont compile
btw im using C#
You are right, I made a mistake because I was not able to test the code, this should work:
Actions actions = new Actions(driver);
actions.MoveToElement(element);
IAction moveToElement = actions.Build();
moveToElement.Perform();
I have also tested your code and I can not reproduce the error.
For issues please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
See CONTRIBUTING.md
Closing the issue, there is no reproduction scenario provided.