Page elements not recognized on different machine while intializing through PageFactort method
Dear friends and colleagues
Here is a wierd scenario or may be someone already facing this issue not sure but see for yourself.
Consider there are 5 fields initialized using PageFactory method. 3 fields are on login page which is already loaded in DOM and remaining 2(Home page after login) fields are not yet loaded in DOM.
Now when I start the login test from my machine remotely on some other client using grid, it works fine.
But when I start the test from another machine remotely on same client using grid does not work.
My toolset Language binding => C# WebDriver 2.47.0, TestRunner => Gallio/mBUnit, Browser => Any(Chrome/FF), DotNet Grid Standalone Server 2.47.1
I have a Login function where all page elements are initialized through PageFactory method as given below
public LoginFunction(driver)
{
PageFactory.InitElements(driver, this);
}
Elements are declared as below
[FindsBy(How = How.CssSelector, Using = @"#UserName")]
[CacheLookup]
public IWebElement UserNameTextField { get; set; }
[FindsBy(How = How.CssSelector, Using = @"#Password")]
[CacheLookup]
public IWebElement PasswordTextField { get; set; }
[FindsBy(How = How.CssSelector, Using = @".span2>input")] //input[@value='Sign in']")]
[CacheLookup]
public IWebElement LoginButton { get; set; }
[FindsBy(How = How.XPath, Using = @"//h2[contains(text(),'Welcome, admin')]")]
[CacheLookup]
public IWebElement WelcomeFormMessageText { get; set; }
[FindsBy(How = How.Id, Using = @"tabslist")]
[CacheLookup]
public IWebElement MainTabsList { get; set; }
Now when the PageFactory.InitElements(driver, this); statement executes, the test fails while initializing WelcomeFormMessageText IWebElement which is actually not present in DOM. These elements are present on Home page after login is successful.
Now the question is the same test runs fine when I run it from my machine and fails when I run it from another machine :-(
Both the machine configs are same having identical OS, browser versions, bit systems etc.
I have tried to run the test on third machine and it fails there too. It only seems to run from my m/c.
Has anyone seen this issue? or have any clue?
Thanks in advance.
This is a question rather than an issue. Please send questions to the selenium user group
For issues please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
See CONTRIBUTING.md