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?

1

2 Answers 2

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.

2
  • 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
    Commented Feb 27, 2019 at 7:27
  • 1
    You should create a new question for the issue you mentioned in comments.
    – Brian
    Commented Jul 22, 2019 at 21:54
0

Search for DotNetSeleniumExtras in Nuget Packages manager and install all of them including waitHelpers

0

Your Answer

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

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