I've updated packages from my project on Mac and find out that PageObjects has been moved to SeleniumExtras. I struggle to use it but the error "System.NullReferenceException : Object reference not set to an instance of an object." is shown. Nevertheless, the same element can be found through FindElement. Currently, I run out of ideas and would appreciate the help. Thanks!
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
using NUnit.Compatibility;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using SeleniumExtras.PageObjects;
namespace SomeTest
{
[TestFixture]
public class UnitTest1
{
[FindsBy(How = How.XPath, Using = "//*[@id='lst-ib']")]
public IWebElement _searchField;
public IWebDriver chrome;
[SetUp]
public void TestMethod1()
{
chrome = new ChromeDriver(@"/Volumes/Macintosh HD/QA/SomeTest/SomeTest/bin/Debug/netcoreapp2.1");
}
[Test]
public void SomeTest()
{
chrome.Navigate().GoToUrl("https://www.google.com/");
_searchField.SendKeys("Some Text");
}
[TearDown]
public void CloseBrowser()
{
chrome.Close();
}
}
}
Got solution: