1

I am using a POM in C# with Xunit as a framework, and am getting error in pagefactory for the following code:

PageFactory.InitElements(driver, login);

Error: "The name PageFactory does not exist in current context", what is the solution for this?

2

The PageFactory class is now considered deprecated in the Selenium binaries; that could be the issue. But, I would still try adding the following to your code to see if it will resolve.

using OpenQA.Selenium.Support.PageObjects;

Failing that, you could use NuGet to install this package in your project.

| improve this answer | |
  • 1
    I've installed the package dotnet selenium extras , it's working, however am not able to write anythings in the textbox using sendkeys, getting an error as Message: System.NullReferenceException : Object reference not set to an instance of an object., would be great if anyone helps this. – Illyaz Feb 27 '19 at 7:27
  • 1
    You should create a new question for the issue you mentioned in comments. – Brian Jul 22 '19 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.