FluentAutomation
FluentAutomation copied to clipboard
PhantomJS: Can't click a button
Using the following quite simple web forms page:
<asp:TextBox ID="tbEmail" runat="server" ClientIDMode="Static" />
<asp:TextBox ID="tbPassword" runat="server" ClientIDMode="Static" />
<asp:Button ID="LoginButton" runat="server" ClientIDMode="Static" />
Using PhantomJS and the following test code:
public LoginPage LoginWithCredentials(string userName, string password) {
this.I.Assert.Exists("#tbEmail");
this.I.Assert.Exists("#tbPassword");
this.I.Assert.Exists("#LoginButton");
this.I.Enter(userName).In("#tbEmail");
this.I.Enter(password).In("#tbPassword");
this.I.Click("#LoginButton");
return this;
}
Clicking on the button fails. It simply doesnt trigger anything.
Replacing this.I.Click(...) with the following code does work as expected:
ElementProxy reference = this.I.Find("#LoginButton");
Element element = (Element)reference.Element;
IWebElement seleniumElement = element.WebElement;
seleniumElement.Click();
It only appears to fail when using PhantomJS. Chrome works fine. I wasn't able to test with Firefox due to the test process crashing, and IE fails with a NullReferenceException.